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

Contents of /trunk/t/01-lookup.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations)
Sat Jul 16 12:40:28 2005 UTC (18 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 725 byte(s)
test also filter

1 #!/usr/bin/perl -w
2
3 use strict;
4 use Test::More tests => 6;
5 use Test::Exception;
6 use blib;
7
8 use Data::Dumper;
9
10 BEGIN {
11 use_ok( 'WebPAC::Lookup' );
12 }
13
14 throws_ok { new WebPAC::Lookup() } qr/lookup_file/, "new without lookup_file";
15
16 ok(my $lookup = new WebPAC::Lookup(
17 lookup_file => 'conf/lookup/example.pm',
18 filter => {
19 'upper' => sub { return uc(shift); },
20 },
21 ), "new");
22
23 my $rec = {
24 '000' => [ '001' ],
25 '800' => [ 'foo' ],
26 '900' => [ 'bar' ],
27 };
28
29 ok($lookup->add( $rec ), "add");
30
31 print Dumper($lookup);
32
33 ok($lookup->{'lookup'}, "have lookup hash");
34
35 my $lookup_res = {
36 '800:foo' => [ 'bar' ],
37 '000:001' => [ '001' ],
38 '900:bar' => [ 'FOO', 'foo' ]
39 };
40
41 is_deeply($lookup_res, $lookup->{'lookup'}, "lookup data");
42

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26