1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
use strict; |
3 |
|
|
use warnings; |
4 |
|
|
use Test; |
5 |
|
|
use FindBin q($Bin); |
6 |
|
|
BEGIN {plan tests => 4} |
7 |
|
|
use SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09; |
8 |
|
|
use SuikaWiki::DB::Util::Error; |
9 |
|
|
|
10 |
|
|
my $dir = $Bin.'/db.tmp'; |
11 |
|
|
mkdir $dir or die "$0: $dir: $!" unless -d $dir; |
12 |
|
|
|
13 |
|
|
try { |
14 |
|
|
my $db = new SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09 |
15 |
|
|
directory => $dir; |
16 |
|
|
|
17 |
|
|
$db->set (test => ['Key'] => 'Value'); |
18 |
|
|
|
19 |
|
|
ok $db->get (test => ['Key']), 'Value'; |
20 |
|
|
ok $db->get (other => ['Key']), undef; |
21 |
|
|
ok $db->get (test => ['other']), undef; |
22 |
|
|
|
23 |
|
|
$db->close; |
24 |
|
|
|
25 |
|
|
my $file = $db->{directory}.$db->{prefix}.$db->__encode_base16 ('test') |
26 |
|
|
.$db->{suffix}; |
27 |
|
|
undef $db; |
28 |
|
|
|
29 |
|
|
ok -e $file, 1, 'Database is written on disk'; |
30 |
|
|
unlink $file or warn "$0: $file: $!"; |
31 |
|
|
} catch SuikaWiki::DB::Util::Error with { |
32 |
|
|
warn shift->stringify; |
33 |
|
|
}; |
34 |
|
|
|