/[pub]/suikawiki/script/t/db-hash.t
Suika

Contents of /suikawiki/script/t/db-hash.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Sat Dec 6 02:18:36 2003 UTC (20 years, 11 months ago) by wakaba
Branch: MAIN
CVS Tags: suikawiki3-redirect, release-3-0-0, HEAD
Branch point for: paragraph-200404, helowiki, helowiki-2005
File MIME type: application/x-troff
New test

1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Test;
5 use FindBin q($Bin);
6 BEGIN {plan tests => 5}
7 use SuikaWiki::DB::Hash;
8
9 my %db;
10 my $db = new SuikaWiki::DB::Hash
11 constructor => sub { \%db },
12 has_exist => 1;
13
14 unshift @{$db->{event}->{error}}, sub {
15 my ($self, $event) = @_;
16 unless ({qw/fatal 1 stop 1 warn 1/}->{$event->{error}->{-def}->{level}}) {
17 warn "DEBUG: ". $event->{error}->stringify;
18 }
19 } if $^W;
20
21 $db->set (test => ['Key'] => 'Value');
22
23 ok $db->get (test => ['Key']), 'Value';
24 ok $db->get (test => ['other']), undef;
25
26 $db->set (test => ['Key', 'Sub'] => 'SubValue');
27 ok $db->get (test => ['Key', 'Sub']), 'SubValue';
28
29 $db->set (test => ['KeySub'] => 'OtherValue');
30 ok $db->get (test => ['KeySub']), 'OtherValue';
31 ok $db->get (test => ['Key', 'Sub']), 'SubValue';
32
33 $db->close;
34
35 undef $db;
36

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24