/[SWISH-PlusPlus]/trunk/t/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/swish.t

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

revision 8 by dpavlin, Sat Dec 4 17:49:20 2004 UTC revision 9 by dpavlin, Sun Dec 5 00:59:50 2004 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 11;  use Test::More tests => 22;
6  use Test::Exception;  use Test::Exception;
7    use lib '.';
8  use blib;  use blib;
9    
10  BEGIN {  BEGIN {
# Line 20  my $index = '/tmp/swish-pp'; Line 21  my $index = '/tmp/swish-pp';
21  $i = SWISH::PlusPlus->open(  $i = SWISH::PlusPlus->open(
22          index_dir => $index,          index_dir => $index,
23          debug => 0,          debug => 0,
24            meta_in_body => 1,
25  );  );
26  ok($i, "open index");  ok($i, "open index");
27    
# Line 31  diag $i->{'version'} || die; Line 33  diag $i->{'version'} || die;
33    
34  ok($i->index_document( 42 => 'meaning of life' ), "index 42");  ok($i->index_document( 42 => 'meaning of life' ), "index 42");
35    
36    ok($i->add(
37            path => 'life',
38            title => 'Ultimate question answer found here',
39            body => '42 is answer to all questions'
40    ), "index life");
41    
42  # add one dummy document so that swish++ won't reject all words  # add one dummy document so that swish++ won't reject all words
43  # with index of just one document  # with index of just one document
44  ok($i->index_document( _dummy_ => '' ), "fillter");  ok($i->index_document( _dummy_ => '' ), "fillter");
# Line 41  foreach my $word (qw(meaning of life)) { Line 49  foreach my $word (qw(meaning of life)) {
49          my @r = $i->search($word);          my @r = $i->search($word);
50          cmp_ok(scalar @r, '==', 1, "find $word");          cmp_ok(scalar @r, '==', 1, "find $word");
51  }  }
52    
53    foreach my $word (qw(Ultimate question answer found here)) {
54            cmp_ok(scalar $i->search("title=($word)"), '==', 1, "find $word in title");
55            cmp_ok(scalar $i->search("$word"), '==', 1, "find $word anywhere");
56    }

Legend:
Removed from v.8  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.26