Really check that sysread(I, $x, 1, -4) dies with "Offset outside string"
[p5sagit/p5-mst-13.2.git] / t / op / ver.t
old mode 100755 (executable)
new mode 100644 (file)
index 759104a..fd1e4d2
@@ -11,7 +11,7 @@ $DOWARN = 1; # enable run-time warnings now
 use Config;
 
 require "test.pl";
-plan( tests => 53 );
+plan( tests => 54 );
 
 eval 'use v5.5.640';
 is( $@, '', "use v5.5.640; $@");
@@ -203,7 +203,7 @@ is(v200, eval( "v200"), 'v200 eq "v200"'        );
 is(v200, eval("+v200"), 'v200 eq eval("+v200")' );
 
 # Tests for string/numeric value of $] itself
-my ($revision,$version,$subversion) = split '\.', sprintf("%vd",$^V);
+my ($revision,$version,$subversion) = split /\./, sprintf("%vd",$^V);
 
 # $^V always displays the leading 'v' but we don't want that here
 $revision =~ s/^v//;
@@ -217,11 +217,7 @@ my $v = sprintf("%d.%.3d%.3d",$revision,$version,$subversion);
 print "# v = '$v'\n";
 print "# ] = '$]'\n";
 
-$v =~ s/000$// if $subversion == 0;
-
-print "# v = '$v'\n";
-
-ok( $v eq "$]", qq{\$^V eq "\$]"});
+is( $v, "$]", qq{\$^V eq "\$]"});
 
 $v = $revision + $version/1000 + $subversion/1000000;
 
@@ -267,3 +263,13 @@ ok( exists $h{chr(65).chr(66)}, "v-stringness is engaged for vX.Y" );
 ok( exists $h{chr(65).chr(66).chr(67)}, "v-stringness is engaged for X.Y.Z" );
 
 
+# The following tests whether v-strings are correctly
+# interpreted by the tokeniser when it's in a XTERMORDORDOR
+# state (fittingly, the only tokeniser state to contain the
+# word MORDOR).
+
+*{"\3"} = *DATA;
+is( (readline v3), "This is what we expect to see!\n", "v-strings even work in Mordor" );
+
+__DATA__
+This is what we expect to see!