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

Annotation of /trunk/t/7-est.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 212 - (hide annotations)
Mon Dec 5 17:47:16 2005 UTC (18 years, 4 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1509 byte(s)
 r11525@llin:  dpavlin | 2005-12-05 01:45:38 +0100
 minor tweaks, tests now pass

1 dpavlin 80 #!/usr/bin/perl -w
2    
3     use strict;
4    
5 dpavlin 212 use Test::More tests => 11;
6 dpavlin 80 use Test::Exception;
7     use Cwd qw/abs_path/;
8     use File::Temp qw/tempdir/;
9     use Data::Dumper;
10     use blib;
11    
12     BEGIN {
13 dpavlin 211 use_ok( 'WebPAC::Output::Estraier' );
14 dpavlin 80 use_ok( 'WebPAC::Search::Estraier' );
15     use_ok( 'Log::Log4perl' );
16     }
17    
18     Log::Log4perl::init('./conf/log.conf');
19     ok(my $log = Log::Log4perl->get_logger('WebPAC.test'), "get_logger");
20    
21 dpavlin 211 my $config = {
22     masterurl => 'http://localhost:1978/',
23 dpavlin 80 user => 'admin',
24     passwd => 'admin',
25 dpavlin 211 database => 'webpac2test',
26 dpavlin 80 encoding => 'iso-8859-2',
27     log => $log,
28 dpavlin 212 debug => 0,
29 dpavlin 211 };
30 dpavlin 80
31 dpavlin 211 ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier");
32    
33     ok(my $list = $est->est_master( action => 'nodelist' ), "nodelist");
34    
35 dpavlin 212 like($list , qr/$config->{database}/, "found $config->{database}");
36 dpavlin 211
37 dpavlin 212 my $ds = {
38     'Source' => {
39     'name' => 'Izvor: ',
40     'tag' => 'Source',
41     'display' => [ 'foo' ],
42     'search' => [ 'demo source '],
43     },
44     'ID' => {
45     'name' => 'ID',
46     'tag' => 'IDths',
47     'search' => [ 'bar' ],
48     'lookup_key' => [ 'bar' ],
49     },
50     'filename' => [ 'out/thes/001.html' ],
51     'name' => 'filename',
52     'tag' => 'filename'
53     };
54    
55     ok($est->add( id => 42, ds => $ds, type => 'search' ), "add");
56    
57 dpavlin 211 ok($est = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier");
58    
59 dpavlin 212 my $query = 'demo';
60     my $max = 1;
61 dpavlin 80
62     ok(my @res = $est->search(
63 dpavlin 126 phrase => $query,
64 dpavlin 212 get_attr => [ qw/ID Source/ ],
65 dpavlin 80 max => $max,
66     ), "search $query, max: $max");
67    
68 dpavlin 81 cmp_ok(($#res + 1), '==', $max, "$max hits");
69 dpavlin 80
70     diag Dumper(\@res);
71    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26