/[webpac2]/trunk/t/7-est.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/7-est.t

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

revision 211 by dpavlin, Mon Dec 5 17:47:10 2005 UTC revision 458 by dpavlin, Wed May 10 14:08:15 2006 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 7;  use Test::More tests => 10;
6  use Test::Exception;  use Test::Exception;
7  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
8  use File::Temp qw/tempdir/;  use File::Temp qw/tempdir/;
# Line 25  my $config = { Line 25  my $config = {
25          database => 'webpac2test',          database => 'webpac2test',
26          encoding => 'iso-8859-2',          encoding => 'iso-8859-2',
27          log => $log,          log => $log,
28          debug => 1,          debug => 0,
29  };  };
30    
31  ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier");  ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier");
32    
33  ok(my $list = $est->est_master( action => 'nodelist' ), "nodelist");  my $ds = {
34            'Source' => {
35                    'name' => 'Izvor: ',
36                    'tag' => 'Source',
37                    'display' => [ 'foo' ],
38                    'search' => [ 'demo source '],
39                    },
40            'ID' => {
41                    'name' => 'ID',
42                    'tag' => 'IDths',
43                    'search' => [ 'bar' ],
44                    'lookup_key' => [ 'bar' ],
45                    },
46            'filename' => [ 'out/thes/001.html' ],
47            'name' => 'filename',
48            'tag' => 'filename'
49    };
50    
51  like($list , qr/$config->{database}/, "$list has $config->{database}");  ok($est->add( id => 42, ds => $ds, type => 'search' ), "add");
52    
53  ok($est = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier");  ok(my $est_s = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier");
54    
55  my $query = 'ivan';  my $query = 'demo';
56  my $max = 3;  my $max = 1;
57    
58  ok(my @res = $est->search(  ok(my @res = $est_s->search(
59          phrase => $query,          phrase => $query,
60          get_attr => [ qw/PersonalName TitleProper/ ],          get_attr => [ qw/ID Source/ ],
61          max => $max,          max => $max,
62  ), "search $query, max: $max");  ), "search $query, max: $max");
63    
# Line 49  cmp_ok(($#res + 1), '==', $max, "$max hi Line 65  cmp_ok(($#res + 1), '==', $max, "$max hi
65    
66  diag Dumper(\@res);  diag Dumper(\@res);
67    
68    ok($est->master( action => 'nodedel', name => 'webpac2test' ), "nodedel");
69    

Legend:
Removed from v.211  
changed lines
  Added in v.458

  ViewVC Help
Powered by ViewVC 1.1.26