/[pub]/suikawiki/script/t/db-fs-swmeta09.t
Suika

Diff of /suikawiki/script/t/db-fs-swmeta09.t

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

revision 1.1 by wakaba, Thu Dec 4 07:23:22 2003 UTC revision 1.2 by wakaba, Fri Dec 5 11:37:30 2003 UTC
# Line 3  use strict; Line 3  use strict;
3  use warnings;  use warnings;
4  use Test;  use Test;
5  use FindBin q($Bin);  use FindBin q($Bin);
6  BEGIN {plan tests => 4}  BEGIN {plan tests => 5}
7  use SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09;  use SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09;
8  use SuikaWiki::DB::Util::Error;  use SuikaWiki::DB::Util::Error;
9    
10  my $dir = $Bin.'/db.tmp';  my $dir = $Bin.'/db.tmp';
11  mkdir $dir or die "$0: $dir: $!" unless -d $dir;  mkdir $dir or die "$0: $dir: $!" unless -d $dir;
12    
 try {  
13  my $db = new SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09  my $db = new SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09
14             directory => $dir;             directory => $dir;
15    
16  $db->set (test => ['Key'] => 'Value');  unshift @{$db->{event}->{error}}, sub {
17      my ($self, $event) = @_;
18      unless ({qw/fatal 1 stop 1 warn 1/}->{$event->{error}->{-def}->{level}}) {
19        warn "DEBUG: ". $event->{error}->stringify;
20      }
21    } if $^W;
22    
23    $db->set (test => ['Key'] => 'Value');
24  ok $db->get (test => ['Key']), 'Value';  ok $db->get (test => ['Key']), 'Value';
25    
26  ok $db->get (other => ['Key']), undef;  ok $db->get (other => ['Key']), undef;
27  ok $db->get (test => ['other']), undef;  ok $db->get (test => ['other']), undef;
28    
29    $db->set (test => ['Key', 'Subkey'] => 'SubValue');
30    ok $db->get (test => ['Key', 'Subkey']), 'SubValue';
31    
32  $db->close;  $db->close;
33    
34  my $file = $db->{directory}.$db->{prefix}.$db->__encode_base16 ('test')  my $file = $db->{directory}.$db->{prefix}.$db->__encode_base16 ('test')
# Line 28  undef $db; Line 37  undef $db;
37    
38  ok -e $file, 1, 'Database is written on disk';  ok -e $file, 1, 'Database is written on disk';
39  unlink $file or warn "$0: $file: $!";  unlink $file or warn "$0: $file: $!";
 } catch SuikaWiki::DB::Util::Error with {  
   warn shift->stringify;  
 };  
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24