--- trunk/t/swish.t 2004/12/03 13:40:34 2 +++ trunk/t/swish.t 2004/12/03 23:30:22 7 @@ -2,7 +2,7 @@ use strict; -use Test::More tests => 4; +use Test::More tests => 8; use Test::Exception; use blib; @@ -12,11 +12,26 @@ my $i; -throws_ok { SWISH::PlusPlus->new() } qr/index/, "need index"; +throws_ok { SWISH::PlusPlus->open() } qr/index_dir/, "need index_dir"; ## FIXME my $index = '/tmp/swish-pp'; -ok($i = new SWISH::PlusPlus( index=> $index ), "new"); +$i = SWISH::PlusPlus->open( + index_dir => $index, +); +ok($i, "open index"); ok(-e $index, "index exist"); + +ok($i->check_bin, "swish++ check"); + +diag $i->{'version'} || die; + +ok($i->index_document( 42 => 'meaning of life' ), "index 42"); + +# add one dummy document so that swish++ won't reject all words +# with index of just one document +ok($i->index_document( _dummy_ => '' ), "fillter"); + +cmp_ok($i->{'index_dir'}, 'eq', $index, "index_dir ok");