/[webpac2]/trunk/t/4-store.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

Diff of /trunk/t/4-store.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 714 by dpavlin, Tue Sep 26 12:42:49 2006 UTC revision 715 by dpavlin, Tue Sep 26 14:03:12 2006 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use Test::More tests => 37;  use Test::More tests => 40;
4  use Test::Exception;  use Test::Exception;
5  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
6  use blib;  use blib;
# Line 25  diag "NULL Store"; Line 25  diag "NULL Store";
25    
26  throws_ok { new WebPAC::Store() } qr/path/, 'new without path';  throws_ok { new WebPAC::Store() } qr/path/, 'new without path';
27    
28  throws_ok { new WebPAC::Store( path => '/tmp' ) } qr/database/, 'new without database';  ok(new WebPAC::Store( path => '/tmp' ), 'new without database');
29    
30  ok($db = new WebPAC::Store( path => '/tmp', database => 'foobar', debug => $debug ), "new");  ok($db = new WebPAC::Store( path => '/tmp', database => 'foobar', debug => $debug ), "new");
31    
# Line 103  my $l = { Line 103  my $l = {
103          foo => { 42 => 1 },          foo => { 42 => 1 },
104  };  };
105    
106    ok(! $db->load_lookup( input => 'non-existant', key => 'foo' ), 'invalid load_lookup');
107    
108  ok($db->save_lookup( input => 'foo', key => 'bar', data => $l ), "save_lookup");  ok($db->save_lookup( input => 'foo', key => 'bar', data => $l ), "save_lookup");
109    
110  ok(-e $db->path . '/lookup/webpac-test/foo/bar', "exists");  ok(-e $db->path . '/lookup/webpac-test/foo/bar', "exists");
111    
112    is_deeply($db->load_lookup( input => 'foo', key => 'bar' ), $l, 'load_lookup');
113    
114  ok($db->save_lookup( database => 'baz', input => 'foo', key => 'bar', data => $l ), "save_lookup with database");  ok($db->save_lookup( database => 'baz', input => 'foo', key => 'bar', data => $l ), "save_lookup with database");
115    
116  ok(-e $db->path . '/lookup/baz/foo/bar', "exists");  ok(-e $db->path . '/lookup/baz/foo/bar', "exists");
117    
118    is_deeply($db->load_lookup( database => 'baz', input => 'foo', key => 'bar' ), $l, 'load_lookup');
119    
120  undef $db;  undef $db;
121    

Legend:
Removed from v.714  
changed lines
  Added in v.715

  ViewVC Help
Powered by ViewVC 1.1.26