11 my $o = tie @a, 'Tie::File', $file;
12 print $o ? "ok $N\n" : "not ok $N\n";
19 check_contents("rec0");
23 check_contents("rec0", "rec1");
25 check_contents("rec0", "rec1", "rec2");
27 # 12-20 same-length alterations
29 check_contents("new0", "rec1", "rec2");
31 check_contents("new0", "new1", "rec2");
33 check_contents("new0", "new1", "new2");
35 # 21-35 lengthening alterations
37 check_contents("long0", "new1", "new2");
39 check_contents("long0", "long1", "new2");
41 check_contents("long0", "long1", "long2");
43 check_contents("long0", "longer1", "long2");
45 check_contents("longer0", "longer1", "long2");
47 # 36-50 shortening alterations, including truncation
49 check_contents("short0", "longer1", "long2");
51 check_contents("short0", "short1", "long2");
53 check_contents("short0", "short1", "short2");
55 check_contents("short0", "sh1", "short2");
57 check_contents("sh0", "sh1", "short2");
59 # (51-56) file with holes
61 check_contents("sh0", "sh1", "short2", "", "rec4");
63 check_contents("sh0", "sh1", "short2", "rec3", "rec4");
65 # (57-59) zero out file
69 # (60-62) insert into the middle of an empty file
71 check_contents("", "", "", "rec3");
76 my $x = join $:, @c, '';
79 # my $open = open FH, "< $file";
81 { local $/; $a = <FH> }
82 $a = "" unless defined $a;
87 print "not ok $N\n# expected <$x>, got <$a>\n";
95 unless ($a[$_] eq "$c[$_]$:") {
96 $msg = "expected $c[$_]$:, got $a[$_]";
101 print $good ? "ok $N\n" : "not ok $N # $msg\n";
104 print $o->_check_integrity($file, $ENV{INTEGRITY})
105 ? "ok $N\n" : "not ok $N\n";
119 1 while unlink $file;