11 my $o = tie @a, 'Tie::File', $file, recsep => 'blah', autochomp => 0;
12 print $o ? "ok $N\n" : "not ok $N\n";
18 check_contents("rec0");
22 check_contents("rec0", "rec1");
24 check_contents("rec0", "rec1", "rec2");
26 # 9-14 same-length alterations
28 check_contents("new0", "rec1", "rec2");
30 check_contents("new0", "new1", "rec2");
32 check_contents("new0", "new1", "new2");
34 # 15-24 lengthening alterations
36 check_contents("long0", "new1", "new2");
38 check_contents("long0", "long1", "new2");
40 check_contents("long0", "long1", "long2");
42 check_contents("long0", "longer1", "long2");
44 check_contents("longer0", "longer1", "long2");
46 # 25-34 shortening alterations, including truncation
48 check_contents("short0", "longer1", "long2");
50 check_contents("short0", "short1", "long2");
52 check_contents("short0", "short1", "short2");
54 check_contents("short0", "sh1", "short2");
56 check_contents("sh0", "sh1", "short2");
60 check_contents("sh0", "sh1", "short2", "", "rec4");
62 check_contents("sh0", "sh1", "short2", "rec3", "rec4");
65 # try inserting a record into the middle of an empty file
70 my $x = join 'blah', @c, '';
74 { local $/; $a = <FH> }
76 $a = "" unless defined $a;
80 my $msg = "# expected <$x>, got <$a>";
82 print "not ok $N $msg\n";
89 unless ($a[$_] eq "$c[$_]blah") {
90 $msg = "expected $c[$_]blah, got $a[$_]";
95 print $good ? "ok $N\n" : "not ok $N # fetch @c\n";
111 1 while unlink $file;