X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbase%2Frs.t;h=f89c84e3a08905f40322f8ebf129daa75cad66be;hb=0aa356c1277870a09fb0a72d88216267eefff4ac;hp=021d699e2e8737bae6dfb2086a767484e869c085;hpb=1f47e8e2e6e01cf4845f0f3f0f0c7524761ffa80;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/base/rs.t b/t/base/rs.t index 021d699..f89c84e 100755 --- a/t/base/rs.t +++ b/t/base/rs.t @@ -1,15 +1,17 @@ #!./perl # Test $! -print "1..14\n"; +print "1..16\n"; $teststring = "1\n12\n123\n1234\n1234\n12345\n\n123456\n1234567\n"; # Create our test datafile +1 while unlink 'foo'; # in case junk left around +rmdir 'foo'; open TESTFILE, ">./foo" or die "error $! $^E opening"; binmode TESTFILE; print TESTFILE $teststring; -close TESTFILE; +close TESTFILE or die "error $! $^E closing"; open TESTFILE, "<./foo"; binmode TESTFILE; @@ -84,9 +86,7 @@ $/ = \$foo; $bar = ; if ($bar eq "78") {print "ok 10\n";} else {print "not ok 10\n";} -# Get rid of the temp file close TESTFILE; -unlink "./foo"; # Now for the tricky bit--full record reading if ($^O eq 'VMS') { @@ -128,3 +128,35 @@ if ($^O eq 'VMS') { # put their own tests in) so we just punt foreach $test (11..14) {print "ok $test # skipped on non-VMS system\n"}; } + +$/ = "\n"; + +# see if open/readline/close work on our and my variables +{ + if (open our $T, "./foo") { + my $line = <$T>; + print "# $line\n"; + length($line) == 40 or print "not "; + close $T or print "not "; + } + else { + print "not "; + } + print "ok 15\n"; +} + +{ + if (open my $T, "./foo") { + my $line = <$T>; + print "# $line\n"; + length($line) == 40 or print "not "; + close $T or print "not "; + } + else { + print "not "; + } + print "ok 16\n"; +} + +# Get rid of the temp file +END { unlink "./foo"; }