/[SWISH-Split]/trunk/t/01api.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/01api.t

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

revision 7 by dpavlin, Fri Dec 17 18:32:34 2004 UTC revision 8 by dpavlin, Sun Dec 19 03:06:01 2004 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 75;  use Test::More tests => 93;
6  use Test::Exception;  use Test::Exception;
7  use File::Temp qw/ :mktemp /;  use File::Temp qw/ :mktemp /;
8  use blib;  use blib;
# Line 19  system "rm -Rf /tmp/swish?????.temp"; Line 19  system "rm -Rf /tmp/swish?????.temp";
19    
20  my %param;  my %param;
21    
22  throws_ok { SWISH::Split->open(%param) } qr/slice_name/, "slice_name";  throws_ok { SWISH::Split->open_index(%param) } qr/slice_name/, "slice_name";
23    
24  sub slice_hash {  sub slice_hash {
25          return $_[0];          return $_[0];
26  };  };
27    
28  $param{'slice_name'} = \&slice_hash;  $param{'slice_name'} = \&slice_hash;
29  throws_ok { SWISH::Split->open(%param) } qr/slices/, "need slices";  throws_ok { SWISH::Split->open_index(%param) } qr/slices/, "need slices";
30    
31  $param{'slices'} = 3;  $param{'slices'} = 3;
32  throws_ok { SWISH::Split->open(%param) } qr/index/, "need index";  throws_ok { SWISH::Split->open_index(%param) } qr/index/, "need index";
33    
34  ok($param{'index'} = mktemp("/tmp/swishXXXXX"), "index name");  ok($param{'index'} = mktemp("/tmp/swishXXXXX"), "index name");
35    
# Line 38  diag "index path: $param{'index'}\n"; Line 38  diag "index path: $param{'index'}\n";
38  ok(open(F, "> $param{'index'}"), "touch");  ok(open(F, "> $param{'index'}"), "touch");
39  close(F);  close(F);
40    
41  throws_ok { SWISH::Split->open(%param) } qr/dir/, "need dir";  throws_ok { SWISH::Split->open_index(%param) } qr/dir/, "need dir";
42    
43  ok(unlink($param{'index'}), "rm");  ok(unlink($param{'index'}), "rm");
44    
# Line 48  $param{'swish_config'} = qq{ Line 48  $param{'swish_config'} = qq{
48  PropertyNames foo  PropertyNames foo
49  };  };
50    
51  ok(my $i=SWISH::Split->open(%param), "open");  $param{'debug'} = 1 if (@ARGV);
52    
53  cmp_ok(my $s = $i->in_slice("swishpath"), '==', 1, "open");  ok(my $i=SWISH::Split->open_index(%param), "open_index");
54    
55    cmp_ok(my $s = $i->in_slice("swishpath"), '==', 1, "open_index");
56    
57  ok(my $config = $i->make_config($s), "make_config");  ok(my $config = $i->make_config($s), "make_config");
58  diag "swish config: $config";  diag "swish config: $config";
# Line 138  foreach (1..$param{'slices'} * 10) { Line 140  foreach (1..$param{'slices'} * 10) {
140  cmp_ok($i->done, '==', 3, "finish");  cmp_ok($i->done, '==', 3, "finish");
141    
142  foreach (1..$param{'slices'}) {  foreach (1..$param{'slices'}) {
143          swish_search( $param{'index'}."/$_", "foo=(bar*)", $slice_files{$_}, "testpath", length($xml)+4, "foo", "bar");          swish_search( $param{'index'}."/$_", "foo=(bar*)", $slice_files{$_}, "testpath", undef, "foo", "bar");
144  }  }
145    
146  #diag "$out";  #diag "$out";

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

  ViewVC Help
Powered by ViewVC 1.1.26