X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fver.t;h=63cb7164dd4816c0640667ab38fcbc2d48c2d07b;hb=20822f61cc01ab34be1e17db483aceb9d5ec8fb7;hp=93ad1f38b8e48dde3063587c20c27de6259a49f3;hpb=44dcb63b0bb49fa80a224080c0601a2af7b94275;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/ver.t b/t/op/ver.t index 93ad1f3..63cb716 100755 --- a/t/op/ver.t +++ b/t/op/ver.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - unshift @INC, "../lib"; + @INC = '../lib'; } -print "1..14\n"; +print "1..23\n"; my $test = 1; @@ -13,9 +13,46 @@ use v5.5.640; require v5.5.640; print "ok $test\n"; ++$test; +# printing characters should work +print v111; +print v107.32; +print "$test\n"; ++$test; + +# hash keys too +$h{v111.107} = "ok"; +print "$h{ok} $test\n"; ++$test; + +# poetry optimization should also +sub v77 { "ok" } +$x = v77; +print "$x $test\n"; ++$test; + +# but not when dots are involved +$x = v77.78.79; +print "not " unless $x eq "MNO"; +print "ok $test\n"; ++$test; + print "not " unless v1.20.300.4000 eq "\x{1}\x{14}\x{12c}\x{fa0}"; print "ok $test\n"; ++$test; +# +# now do the same without the "v" +use 5.5.640; +require 5.5.640; +print "ok $test\n"; ++$test; + +# hash keys too +$h{111.107.32} = "ok"; +print "$h{ok } $test\n"; ++$test; + +$x = 77.78.79; +print "not " unless $x eq "MNO"; +print "ok $test\n"; ++$test; + +print "not " unless 1.20.300.4000 eq "\x{1}\x{14}\x{12c}\x{fa0}"; +print "ok $test\n"; ++$test; + +# test sprintf("%vd"...) etc print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108'; print "ok $test\n"; ++$test; @@ -25,7 +62,7 @@ print "ok $test\n"; ++$test; print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c'; print "ok $test\n"; ++$test; -print "not " unless sprintf("%vX", v1.22.333.4444) eq '1.16.14D.115C'; +print "not " unless sprintf("%vX", 1.22.333.4444) eq '1.16.14D.115C'; print "ok $test\n"; ++$test; print "not " unless sprintf("%*v#o", ":", "Perl") eq '0120:0145:0162:0154'; @@ -35,13 +72,18 @@ print "not " unless sprintf("%*vb", "##", v1.22.333.4444) eq '1##10110##101001101##1000101011100'; print "ok $test\n"; ++$test; +print "not " unless sprintf("%vd", join("", map { chr } + unpack "U*", v2001.2002.2003)) + eq '2001.2002.2003'; +print "ok $test\n"; ++$test; + { use bytes; print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108'; print "ok $test\n"; ++$test; print "not " unless - sprintf("%vd", v1.22.333.4444) eq '1.22.197.141.225.133.156'; + sprintf("%vd", 1.22.333.4444) eq '1.22.197.141.225.133.156'; print "ok $test\n"; ++$test; print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c';