2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
use Test::More tests => 27; |
use Test::More tests => 29; |
6 |
use Test::Exception; |
use Test::Exception; |
7 |
use lib '.'; |
use lib '.'; |
8 |
use blib; |
use blib; |
27 |
|
|
28 |
ok(-e $index, "index exist"); |
ok(-e $index, "index exist"); |
29 |
|
|
30 |
|
ok($i->{'cwd'}, "cwd ".$i->{'cwd'}); |
31 |
|
|
32 |
ok($i->check_bin, "swish++ check"); |
ok($i->check_bin, "swish++ check"); |
33 |
|
|
34 |
diag $i->{'version'} || die; |
ok($i->{'version'}, "version ".$i->{'version'}); |
35 |
|
|
36 |
ok($i->index_document( 42 => 'meaning of life' ), "index 42"); |
ok($i->index_document( 42 => 'meaning of life' ), "index 42"); |
37 |
|
|
52 |
|
|
53 |
cmp_ok($i->{'index_dir'}, 'eq', $index, "index_dir ok"); |
cmp_ok($i->{'index_dir'}, 'eq', $index, "index_dir ok"); |
54 |
|
|
55 |
|
# I would rather test search to close it itself! |
56 |
|
#$i->finish_update; |
57 |
|
|
58 |
foreach my $word (qw(meaning of life)) { |
foreach my $word (qw(meaning of life)) { |
59 |
my @r = $i->search($word); |
my @r = $i->search($word); |
60 |
cmp_ok(scalar @r, '==', 1, "find $word"); |
cmp_ok(scalar @r, '==', 1, "find $word"); |