# now check FETCH:
my $good = 1;
+ my $msg;
for (0.. $#c) {
- $good = 0 unless $a[$_] eq "$c[$_]$/";
+ unless ($a[$_] eq "$c[$_]$/") {
+ $msg = "expected $c[$_]$/, got $a[$_]";
+ $msg =~ s{$/}{\\n}g;
+ $good = 0;
+ }
}
- print (($open && $good) ? "ok $N\n" : "not ok $N # fetch @c\n");
+ print $good ? "ok $N\n" : "not ok $N # $msg\n";
$N++;
-
- print $o->_check_integrity($file, $ENV{INTEGRITY})
- ? "ok $N\n" : "not ok $N\n";
- $N++;
}
END {
splice(@a, 0, 17);
check_contents("");
-# This test ignored because it causes 5.6.1 and 5.7.3 to dump core
+ # (89-92) In the past, splicing past the end was not correctly detected
+ # (1.14)
+ splice(@a, 89, 3);
+ check_contents("");
+ splice(@a, @a, 3);
+ check_contents("");
+
+ # (93-96) Also we did not emulate splice's freaky behavior when inserting
+ # past the end of the array (1.14)
+ splice(@a, 89, 0, "I", "like", "pie");
+ check_contents("Iblahlikeblahpieblah");
+ splice(@a, 89, 0, "pie pie pie");
+ check_contents("Iblahlikeblahpieblahpie pie pieblah");
+
+ # (97) Splicing with too large a negative number should be fatal
-if ($] < 5.006 || $] > 5.007003) {
++# This test ignored because it causes 5.6.1 and 5.7.2 to dump core
+ # NOT MY FAULT
- print "ok $N \# skipped (5.6.0 through 5.7.3 dump core here.)\n";
++if ($] < 5.006 || $] > 5.007002) {
+ eval { splice(@a, -7, 0) };
+ print $@ =~ /^Modification of non-creatable array value attempted, subscript -7/
+ ? "ok $N\n" : "not ok $N \# \$\@ was '$@'\n";
+ } else {
++ print "ok $N \# skipped (5.6.0 through 5.7.2 dump core here.)\n";
+ }
+ $N++;
+
+ # (98-101) Test default arguments
+ splice @a, 0, 0, (0..11);
+ splice @a, 4;
+ check_contents("0blah1blah2blah3blah");
+ splice @a;
+ check_contents("");
+
+
sub init_file {
my $data = shift;
open F, "> $file" or die $!;