/[webpac2]/trunk/t/5-output-swish.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/5-output-swish.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1146 by dpavlin, Thu Apr 23 11:14:24 2009 UTC revision 1147 by dpavlin, Thu Apr 23 13:20:51 2009 UTC
# Line 6  use blib; Line 6  use blib;
6  use Test::More tests => 35;  use Test::More tests => 35;
7    
8  BEGIN {  BEGIN {
9  use_ok( 'WebPAC::Test' );          use lib 'lib';
10  use_ok( 'WebPAC::Output::SWISH' );          use_ok( 'WebPAC::Test' );
11  use_ok( 'SWISH::API' );          use_ok( 'WebPAC::Output::SWISH' );
12            use_ok( 'SWISH::API' );
13  }  }
14    
15  my $path = "$abs_path/kino/";  my $path = "$abs_path/kino/";
16    
17  ok(my $out = new WebPAC::Output::SWISH(  ok(my $out = new WebPAC::Output::SWISH({
18          database => 'test',          database => 'test',
19          %LOG          %LOG
20  ), "new");  }), "new");
21    
22    ok( $out->init, 'init' );
23    
24  my $ds = {  my $ds = {
25          'Source' => {          'Source' => {
# Line 24  my $ds = { Line 27  my $ds = {
27                  'search' => [ 'tko zna' ]                  'search' => [ 'tko zna' ]
28          },          },
29          'ID' => {          'ID' => {
30                  'search' => 'id',                  'search' => [ 'id' ],
31          },          },
32          'Array' => {          'Array' => {
33                  'search' => [ qw/a1 a2 s3 a4 a5/ ],                  'search' => [ qw/a1 a2 s3 a4 a5/ ],
# Line 34  my $ds = { Line 37  my $ds = {
37          },          },
38  };  };
39    
 throws_ok { $out->add( ) } qr/need id/, 'add without params';  
 throws_ok { $out->add( 42 ) } qr/need ds/, 'add without ds';  
   
40  ok( $out->add( 42, $ds ), 'add 42' );  ok( $out->add( 42, $ds ), 'add 42' );
41    
42  my @strange = ( qw/čajđinica odmašćivanje žabokrečina šuma/ );  my @strange = ( qw/čajđinica odmašćivanje žabokrečina šuma/ );
# Line 53  sub test_search { Line 53  sub test_search {
53          my $swish = SWISH::API->new( $out->index_path );          my $swish = SWISH::API->new( $out->index_path );
54          $swish->abort_last_error if $swish->Error;          $swish->abort_last_error if $swish->Error;
55    
56          my $results = $swish->search( $query_string );          my $results = $swish->query( $query_string );
57    
58          my $total_hits = $results->hits;          my $total_hits = $results->hits;
59    

Legend:
Removed from v.1146  
changed lines
  Added in v.1147

  ViewVC Help
Powered by ViewVC 1.1.26