/[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

Annotation of /trunk/t/swish.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (hide annotations)
Sat Dec 4 17:49:20 2004 UTC (19 years, 4 months ago) by dpavlin
File MIME type: application/x-troff
File size: 825 byte(s)
search is working

1 dpavlin 2 #!/usr/bin/perl -w
2    
3     use strict;
4    
5 dpavlin 8 use Test::More tests => 11;
6 dpavlin 2 use Test::Exception;
7     use blib;
8    
9     BEGIN {
10     use_ok('SWISH::PlusPlus')
11     };
12    
13     my $i;
14    
15 dpavlin 3 throws_ok { SWISH::PlusPlus->open() } qr/index_dir/, "need index_dir";
16 dpavlin 2
17     ## FIXME
18     my $index = '/tmp/swish-pp';
19    
20 dpavlin 3 $i = SWISH::PlusPlus->open(
21     index_dir => $index,
22 dpavlin 8 debug => 0,
23 dpavlin 3 );
24     ok($i, "open index");
25 dpavlin 2
26     ok(-e $index, "index exist");
27 dpavlin 3
28     ok($i->check_bin, "swish++ check");
29    
30     diag $i->{'version'} || die;
31 dpavlin 4
32     ok($i->index_document( 42 => 'meaning of life' ), "index 42");
33    
34     # add one dummy document so that swish++ won't reject all words
35     # with index of just one document
36     ok($i->index_document( _dummy_ => '' ), "fillter");
37 dpavlin 7
38     cmp_ok($i->{'index_dir'}, 'eq', $index, "index_dir ok");
39 dpavlin 8
40     foreach my $word (qw(meaning of life)) {
41     my @r = $i->search($word);
42     cmp_ok(scalar @r, '==', 1, "find $word");
43     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26