3 # Regular read-write tests with caching disabled
12 print "ok $N\n"; $N++;
14 my $o = tie @a, 'Tie::File', $file, autochomp => 0, autodefer => 0, memory => 0;
15 print $o ? "ok $N\n" : "not ok $N\n";
22 check_contents("rec0");
26 check_contents("rec0", "rec1");
28 check_contents("rec0", "rec1", "rec2");
30 # 12-20 same-length alterations
32 check_contents("new0", "rec1", "rec2");
34 check_contents("new0", "new1", "rec2");
36 check_contents("new0", "new1", "new2");
38 # 21-35 lengthening alterations
40 check_contents("long0", "new1", "new2");
42 check_contents("long0", "long1", "new2");
44 check_contents("long0", "long1", "long2");
46 check_contents("long0", "longer1", "long2");
48 check_contents("longer0", "longer1", "long2");
50 # 36-50 shortening alterations, including truncation
52 check_contents("short0", "longer1", "long2");
54 check_contents("short0", "short1", "long2");
56 check_contents("short0", "short1", "short2");
58 check_contents("short0", "sh1", "short2");
60 check_contents("sh0", "sh1", "short2");
62 # (51-56) file with holes
64 check_contents("sh0", "sh1", "short2", "", "rec4");
66 check_contents("sh0", "sh1", "short2", "rec3", "rec4");
68 # (57-59) zero out file
72 # (60-62) insert into the middle of an empty file
74 check_contents("", "", "", "rec3");
76 # (63-68) 20020326 You thought there would be a bug in STORE where if
77 # a cached record was false, STORE wouldn't see it at all. But you
78 # forgot that records always come back from the cache with the record
79 # separator attached, so they are unlikely to be false. The only
80 # really weird case is when the cached record is empty and the record
81 # separator is "0". Test that in 09_gen_rs.t.
83 check_contents("", "0", "", "rec3");
85 check_contents("", "whoops", "", "rec3");
91 my $x = join $:, @c, '';
94 # my $open = open FH, "< $file";
96 { local $/; $a = <FH> }
97 $a = "" unless defined $a;
102 print "not ok $N\n# expected <$x>, got <$a>\n";
111 unless ($aa eq "$c[$_]$:") {
112 $msg = "expected <$c[$_]$:>, got <$aa>";
117 print $good ? "ok $N\n" : "not ok $N # $msg\n";
120 print $o->_check_integrity($file, $ENV{INTEGRITY})
121 ? "ok $N\n" : "not ok $N\n";
135 1 while unlink $file;