--- trunk/t/4-store.t 2006/09/26 12:47:52 714 +++ trunk/t/4-store.t 2006/09/26 14:03:12 715 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::More tests => 37; +use Test::More tests => 40; use Test::Exception; use Cwd qw/abs_path/; use blib; @@ -25,7 +25,7 @@ throws_ok { new WebPAC::Store() } qr/path/, 'new without path'; -throws_ok { new WebPAC::Store( path => '/tmp' ) } qr/database/, 'new without database'; +ok(new WebPAC::Store( path => '/tmp' ), 'new without database'); ok($db = new WebPAC::Store( path => '/tmp', database => 'foobar', debug => $debug ), "new"); @@ -103,13 +103,19 @@ foo => { 42 => 1 }, }; +ok(! $db->load_lookup( input => 'non-existant', key => 'foo' ), 'invalid load_lookup'); + ok($db->save_lookup( input => 'foo', key => 'bar', data => $l ), "save_lookup"); ok(-e $db->path . '/lookup/webpac-test/foo/bar', "exists"); +is_deeply($db->load_lookup( input => 'foo', key => 'bar' ), $l, 'load_lookup'); + ok($db->save_lookup( database => 'baz', input => 'foo', key => 'bar', data => $l ), "save_lookup with database"); ok(-e $db->path . '/lookup/baz/foo/bar', "exists"); +is_deeply($db->load_lookup( database => 'baz', input => 'foo', key => 'bar' ), $l, 'load_lookup'); + undef $db;