--- trunk/t/01-lookup.t 2005/07/16 11:07:38 3 +++ trunk/t/01-lookup.t 2005/07/16 12:37:18 4 @@ -1,14 +1,37 @@ #!/usr/bin/perl -w -use Test::More tests => 3; +use strict; +use Test::More tests => 6; use Test::Exception; use blib; -use strict; + +use Data::Dumper; BEGIN { -use_ok( 'WebPAC::Normalize::Lookup' ); +use_ok( 'WebPAC::Lookup' ); } -throws_ok { new WebPAC::Normalize::Lookup() } qr/config/, "new without config"; +throws_ok { new WebPAC::Lookup() } qr/lookup_file/, "new without lookup_file"; + +ok(my $lookup = new WebPAC::Lookup( lookup_file => 'conf/lookup/example.pm' ), "new"); + +my $rec = { + '000' => [ '001' ], + '800' => [ 'foo' ], + '900' => [ 'bar' ], +}; + +ok($lookup->add( $rec ), "add"); + +print Dumper($lookup); + +ok($lookup->{'lookup'}, "have lookup hash"); + +my $lookup_res = { + '800:foo' => [ 'bar' ], + '000:001' => [ '001' ], + '900:bar' => [ 'foo', 'foo' ] +}; + +is_deeply($lookup_res, $lookup->{'lookup'}, "lookup data"); -ok(my $nos = new WebPAC::Normalize::Lookup( config => 'conf/lookup/isis.pm' ), "new");