ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/TDB_FileX/t/03_callbacks.t
Revision: 1.2
Committed: Tue Apr 29 21:27:54 2025 UTC (17 months, 3 weeks ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-0_97, HEAD
Changes since 1.1: +4 -5 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! /usr/bin/perl -w
2
3 #
4 # test persistant storage and error returns
5 #
6
7 use Test;
8 use Fcntl;
9
10 BEGIN { plan tests => 9 };
11
12 use TDB_FileX ":all";
13
14 unlink("test.tdb");
15 my $tdb = TDB_FileX->open("test.tdb", tdb_flags => DEFAULT, open_flags => O_RDWR, mode => 0664);
16 ok(!$tdb);
17
18 $tdb = TDB_FileX->open("test.tdb", tdb_flags => CLEAR_IF_FIRST);
19 ok($tdb);
20
21 ok (!eval { $tdb->store (foo => 'bar', MODIFY), 1 });
22 ok($! == TDB_FileX::ERR_NOEXIST);
23 ok($tdb->error, ERR_NOEXIST);
24 ok($tdb->errorstr, 'Record does not exist');
25
26 ok (eval { $tdb->store (foo => 'bar', INSERT); 1 });
27
28 undef $tdb;
29
30 ok($tdb = TDB_FileX->open("test.tdb"));
31
32 ok($tdb->fetch('foo'), 'bar');