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

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

trunk/t/4-db.tt revision 18 by dpavlin, Sun Jul 17 14:53:37 2005 UTC trunk/t/4-db.t revision 20 by dpavlin, Sun Jul 17 21:04:23 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use Test::More tests => 22;  use Test::More tests => 25;
4  use Test::Exception;  use Test::Exception;
5  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
6  use blib;  use blib;
# Line 16  $abs_path =~ s#/[^/]*$#/#; Line 16  $abs_path =~ s#/[^/]*$#/#;
16  diag "abs_path: $abs_path";  diag "abs_path: $abs_path";
17    
18  my $db;  my $db;
19    my $debug = 1;
20    
21  diag "NULL DB";  diag "NULL DB";
22    
23  ok($db = new WebPAC::DB( debug => 1), "new");  ok($db = new WebPAC::DB( debug => $debug ), "new");
24    
25  ok(! $db->path, "path");  ok(! $db->path, "path");
26    
# Line 35  ok(my $path = tempdir(), "path"); Line 36  ok(my $path = tempdir(), "path");
36    
37  diag "DB path: $path";  diag "DB path: $path";
38    
39  ok($db = new WebPAC::DB( path => $path, debug => 1), "new");  ok($db = new WebPAC::DB( path => $path, debug => $debug ), "new");
40    
41  cmp_ok($db->{'path'}, 'eq', $path, "path");  cmp_ok($db->{'path'}, 'eq', $path, "path");
42    
43  ok(! $db->path, "path - disable caching");  ok(! $db->path(''), "path - disable caching");
44    
45  cmp_ok($db->{'path'}, '==', undef, "no path");  cmp_ok($db->{'path'}, '==', undef, "no path");
46    
47  ok($db->path( $path ), "path($path)");  ok($db->path( $path ), "path($path)");
48    
49    cmp_ok($db->{'path'}, 'eq', $path, "path");
50    
51  ok(! $db->load_gs(), 'load_gs');  ok(! $db->load_gs(), 'load_gs');
52  ok(! $db->load_gs({ '000' => '000' }), 'load_gs');  ok(! $db->load_gs({ '000' => '000' }), 'load_gs');
53    
# Line 73  throws_ok { $db->save_gs( ds => \@ds, 'c Line 76  throws_ok { $db->save_gs( ds => \@ds, 'c
76    
77  ok($db->save_gs( ds => \@ds, 'current_filename' => 'foo', 'headline' => 'bar' ), "save_gs");  ok($db->save_gs( ds => \@ds, 'current_filename' => 'foo', 'headline' => 'bar' ), "save_gs");
78    
79    ok(my @ds2 = $db->load_gs({ '000' => '000' }), "load_gs");
80    
81    is_deeply(\@ds, \@ds2, "loaded data");
82    
83  undef $db;  undef $db;
84    

Legend:
Removed from v.18  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC 1.1.26