my $file = "tf$$.txt";
print "1..71\n";
my $N = 1;
print "ok $N\n"; $N++;
print $o ? "ok $N\n" : "not ok $N\n";
$N++;
# 3-5 create
$a[0] = 'rec0';
# 6-11 append
$a[1] = 'rec1';
$a[2] = 'rec2';
# 12-20 same-length alterations
$a[0] = 'new0';
$a[1] = 'new1';
$a[2] = 'new2';
# 21-35 lengthening alterations
$a[0] = 'long0';
$a[1] = 'long1';
$a[2] = 'long2';
$a[1] = 'longer1';
$a[0] = 'longer0';
# 36-50 shortening alterations, including truncation
$a[0] = 'short0';
$a[1] = 'short1';
$a[2] = 'short2';
$a[1] = 'sh1';
$a[0] = 'sh0';
# (51-56) file with holes
$a[4] = 'rec4';
$a[3] = 'rec3';
# (57-59) zero out file
@a = ();
# (60-62) insert into the middle of an empty file
$a[3] = "rec3";
# (63-68) Test the ->autochomp() method
@a = qw(Gold Frankincense Myrrh);
my $ac;
# See if that accidentally changed it
# Now clear it
# Now set it again
# (69) Does 'splice' work correctly with autochomp?
my @sr;
# (70-71) Didn't you forget that fetch may return an unchomped cached record?
$a2 = $a[0];
# Actually no, you didn't---_fetch might return such a record, but
# the chomping is done by FETCH.
use POSIX 'SEEK_SET';
my @c = @_;
# my $open = open FH, "< $file";
my $a;
{ local $/; $a = <FH> }
print "ok $N\n";
} else {
print "not ok $N\n# expected <$x>, got <$a>\n";
}
$N++;
# now check FETCH:
my $good = 1;
my $msg;
for (0.. $#c) {
my $aa = $a[$_];
$good = 0;
}
}
$N++;
? "ok $N\n" : "not ok $N\n";
$N++;
}
sub expect {
if (@_ == 1) {
print $_[0] ? "ok $N\n" : "not ok $N\n";
} elsif (@_ == 2) {
my ($a, $x) = @_;
}
else {
}
} else {
}
$N++;
}
sub ctrlfix {
for (@_) {
s/\n/\\n/g;
s/\r/\\r/g;
}
}
END {
undef $o;
untie @a;
}