ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/TDB_FileX/t/04_persistent.t
Revision: 1.1
Committed: Fri Apr 25 16:43:02 2025 UTC (16 months, 4 weeks ago) by root
Content type: application/x-troff
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #! /usr/bin/perl -w
2    
3     #
4     # test tie interface
5     #
6    
7     use Test;
8    
9     BEGIN { plan tests => 9 };
10    
11     use TDB_FileX ":all";
12    
13     {
14     # prime test.tdb
15     my $tdb = TDB_FileX->open("test.tdb", tdb_flags => CLEAR_IF_FIRST);
16     ok($tdb);
17    
18     ok($tdb->store(foo => 'bar', TDB_FileX::INSERT));
19     }
20    
21     my %db;
22     ok(tie %db, 'TDB_FileX', 'test.tdb');
23    
24     ok($db{foo}, 'bar');
25    
26     ok(not exists $db{baz});
27    
28     $db{baz} = 1234;
29     ok($db{baz}, 1234);
30    
31     delete $db{baz};
32     ok(not exists $db{baz});
33    
34     ok(scalar keys(%db), 1);
35    
36     %db = ();
37     ok(not scalar %db);