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