4 use Test::More tests => 16;
11 use_ok( 'WebPAC::Lookup' );
14 throws_ok { new WebPAC::Lookup() } qr/lookup_file/, "new without lookup_file";
16 ok(my $lookup = new WebPAC::Lookup(
17 lookup_file => 'conf/lookup/example.pm',
19 'upper' => sub { return uc(shift); },
23 ok(my $regex = $lookup->regex, "regex");
32 diag "testing WebPAC::Lookup own methods";
34 ok($lookup->add( $rec ), "add");
36 ok($lookup->{'lookup'}, "have lookup hash");
39 '800:foo' => [ 'bar' ],
40 '000:001' => [ '001' ],
41 '900:bar' => [ 'FOO', 'foo' ]
44 is_deeply($lookup_res, $lookup->{'lookup'}, "lookup data");
46 foreach my $k (keys %{ $lookup_res }) {
47 ok(my @l = $lookup->lookup("lookup{$k}"), "lookup{$k}");
49 cmp_ok($#l, '==', $#{$lookup_res->{$k}}, "result size");
51 is_deeply($lookup_res->{$k}, \@l, "result values");
54 diag "testing WebPAC::Lookup inherited methods";