summaryrefslogtreecommitdiff
path: root/t/base
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2006-04-08 21:25:33 +0300
committerNicholas Clark <nick@ccl4.org>2006-04-08 22:23:26 +0000
commitacbd132f67ad3746742c9e471142632e10bb9acc (patch)
tree77aac9aa706b9e2c9b1f6df95dba1dcb84f4d37e /t/base
parenta41cc44e8f73bd00013181fc01efa2336fcb557e (diff)
downloadperl-acbd132f67ad3746742c9e471142632e10bb9acc.tar.gz
sv.c, rs.t, perlvar.pod (Coverity finding: did you know what happens with $/=\0?)
Message-Id: <20060408152533.C4D5F6D08C@ugli.hut.fi> (although I should add that this version of Coverity is actually raising a false positive here, albeit something still interesting) p4raw-id: //depot/perl@27744
Diffstat (limited to 't/base')
-rwxr-xr-xt/base/rs.t21
1 files changed, 13 insertions, 8 deletions
diff --git a/t/base/rs.t b/t/base/rs.t
index f89c84e3a0..d06fa7346f 100755
--- a/t/base/rs.t
+++ b/t/base/rs.t
@@ -1,7 +1,7 @@
#!./perl
# Test $!
-print "1..16\n";
+print "1..17\n";
$teststring = "1\n12\n123\n1234\n1234\n12345\n\n123456\n1234567\n";
@@ -86,6 +86,11 @@ $/ = \$foo;
$bar = <TESTFILE>;
if ($bar eq "78") {print "ok 10\n";} else {print "not ok 10\n";}
+# Naughty straight number - should get the rest of the file
+$/ = \0;
+$bar = <TESTFILE>;
+if ($bar eq "90123456789012345678901234567890") {print "ok 11\n";} else {print "not ok 11\n";}
+
close TESTFILE;
# Now for the tricky bit--full record reading
@@ -110,23 +115,23 @@ if ($^O eq 'VMS') {
open TESTFILE, "<./foo.bar";
$/ = \10;
$bar = <TESTFILE>;
- if ($bar eq "foo\n") {print "ok 11\n";} else {print "not ok 11\n";}
+ if ($bar eq "foo\n") {print "ok 12\n";} else {print "not ok 12\n";}
$bar = <TESTFILE>;
- if ($bar eq "foobar\n") {print "ok 12\n";} else {print "not ok 12\n";}
+ if ($bar eq "foobar\n") {print "ok 13\n";} else {print "not ok 13\n";}
# can we do a short read?
$/ = \2;
$bar = <TESTFILE>;
- if ($bar eq "ba") {print "ok 13\n";} else {print "not ok 13\n";}
+ if ($bar eq "ba") {print "ok 14\n";} else {print "not ok 14\n";}
# do we get the rest of the record?
$bar = <TESTFILE>;
- if ($bar eq "z\n") {print "ok 14\n";} else {print "not ok 14\n";}
+ if ($bar eq "z\n") {print "ok 15\n";} else {print "not ok 15\n";}
close TESTFILE;
1 while unlink qw(foo.bar foo.com foo.fdl);
} else {
# Nobody else does this at the moment (well, maybe OS/390, but they can
# put their own tests in) so we just punt
- foreach $test (11..14) {print "ok $test # skipped on non-VMS system\n"};
+ foreach $test (12..15) {print "ok $test # skipped on non-VMS system\n"};
}
$/ = "\n";
@@ -142,7 +147,7 @@ $/ = "\n";
else {
print "not ";
}
- print "ok 15\n";
+ print "ok 16\n";
}
{
@@ -155,7 +160,7 @@ $/ = "\n";
else {
print "not ";
}
- print "ok 16\n";
+ print "ok 17\n";
}
# Get rid of the temp file