From: Vincent Pit Date: Sun, 17 Jul 2011 22:48:02 +0000 (+0200) Subject: Replace $] by "$]" in tests X-Git-Tag: v0.24~3 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=commitdiff_plain;h=b11e5a01561dde92d778ab423666bc76ac358c6a;hp=94eaa9a61ca1429f0cf218ba0e6512f0c0c073aa Replace $] by "$]" in tests An old bug could cause $] to be initialized to a wrong decimal value. Since its stringified value was always right, we use it instead. --- diff --git a/t/20-good.t b/t/20-good.t index 97c874c..e04ee9d 100644 --- a/t/20-good.t +++ b/t/20-good.t @@ -192,9 +192,9 @@ meh $x, 1, 2; meh $y; #### meh $y, 1, 2; -#### $] < 5.010 # use feature 'state'; state $z +#### "$]" < 5.010 # use feature 'state'; state $z meh $z; -#### $] < 5.010 # use feature 'state'; state $z +#### "$]" < 5.010 # use feature 'state'; state $z meh $z, 1, 2; #### print; @@ -208,9 +208,9 @@ print $x "oh hai\n"; print $y; #### print $y "dongs\n"; -#### $] < 5.010 # use feature 'state'; state $z +#### "$]" < 5.010 # use feature 'state'; state $z print $z; -#### $] < 5.010 # use feature 'state'; state $z +#### "$]" < 5.010 # use feature 'state'; state $z print $z "hlagh\n"; #### print STDOUT "bananananananana\n"; diff --git a/t/21-bad.t b/t/21-bad.t index c594462..fa2c322 100644 --- a/t/21-bad.t +++ b/t/21-bad.t @@ -101,7 +101,7 @@ SKIP: SKIP: { skip 'No space tests on perl 5.11' => 4 + @expected - if $] >= 5.011 and $] < 5.012; + if "$]" >= 5.011 and "$]" < 5.012; my $code = $code; $code =~ s/\$/\$ \n\t /g; @@ -280,15 +280,15 @@ meh $y 1, 2; meh $y, 1, 2; ---- [ 'meh', '$y' ] -#### $] < 5.010 # use feature 'state'; state $z +#### "$]" < 5.010 # use feature 'state'; state $z meh $z; ---- [ 'meh', '$z' ] -#### $] < 5.010 # use feature 'state'; state $z +#### "$]" < 5.010 # use feature 'state'; state $z meh $z 1, 2; ---- [ 'meh', '$z' ] -#### $] < 5.010 # use feature 'state'; state $z +#### "$]" < 5.010 # use feature 'state'; state $z meh $z, 1, 2; ---- [ 'meh', '$z' ] diff --git a/t/30-scope.t b/t/30-scope.t index afb0e40..644c3de 100644 --- a/t/30-scope.t +++ b/t/30-scope.t @@ -73,7 +73,7 @@ sub expect { } } is $@, '', "no indirect; eval 'my \$x = new Bar'"; - if ($] < 5.009005) { + if ("$]" < 5.009005) { is @w, 0, 'no warnings caught'; pass 'placeholder'; } else { @@ -85,7 +85,7 @@ sub expect { SKIP: { skip 'The pragma doesn\'t propagte into eval STRING before perl 5.10' => 2 - if $] < 5.009005; + if "$]" < 5.009005; my @w; my $test = sub { eval 'return; new XYZ' }; { @@ -116,13 +116,13 @@ SKIP: { eval "return; no indirect; use indirect::TestRequired2; my \$x = new Bar;"; } is $@, '', 'second require test doesn\'t croak prematurely'; - @w = grep !/^warn:Attempt\s+to\s+free\s+unreferenced/, @w if $] <= 5.008003; + @w = grep !/^warn:Attempt\s+to\s+free\s+unreferenced/, @w if "$]" <= 5.008003; my $w = shift @w; like $w, expect('Baz', 't/lib/indirect/TestRequired2.pm'), 'second require test caught error for Baz'; SKIP: { skip 'The pragma doesn\'t propagte into eval STRING before perl 5.10' => 1 - if $] < 5.009005; + if "$]" < 5.009005; $w = shift @w; like $w, expect('Blech'), 'second require test caught error for Blech'; } @@ -146,7 +146,7 @@ SKIP: { new indirect::TestRequired3Z; } TESTREQUIRED3 - @w = grep !/^warn:Attempt\s+to\s+free\s+unreferenced/, @w if $] <= 5.008003; + @w = grep !/^warn:Attempt\s+to\s+free\s+unreferenced/, @w if "$]" <= 5.008003; is $@, '', "pragma leak when reusing callback test doesn't croak prematurely"; is_deeply \@w, [ ], diff --git a/t/31-hints.t b/t/31-hints.t index 0b271b4..4f4b5e2 100644 --- a/t/31-hints.t +++ b/t/31-hints.t @@ -7,7 +7,7 @@ use Test::More tests => 1; SKIP: { skip 'This would require extensive work to be okay with perl 5.8' => 1 - if $] < 5.010; + if "$]" < 5.010; local %^H = (a => 1); diff --git a/t/40-threads.t b/t/40-threads.t index 4263ea5..bde269a 100644 --- a/t/40-threads.t +++ b/t/40-threads.t @@ -16,7 +16,7 @@ BEGIN { skipall 'This perl wasn\'t built to support threads' unless $Config{useithreads}; skipall 'perl 5.13.4 required to test thread safety' - unless $force or $] >= 5.013004; + unless $force or "$]" >= 5.013004; } use threads; @@ -60,7 +60,7 @@ sub expect { SKIP: { skip 'Hints aren\'t propagated into eval STRING below perl 5.10' => 3 - unless $] >= 5.010; + unless "$]" >= 5.010; my $class = "Pineapple$tid"; my @warns; { diff --git a/t/41-threads-teardown.t b/t/41-threads-teardown.t index 8531afe..0b4405e 100644 --- a/t/41-threads-teardown.t +++ b/t/41-threads-teardown.t @@ -16,7 +16,7 @@ BEGIN { skipall 'This perl wasn\'t built to support threads' unless $Config{useithreads}; skipall 'perl 5.13.4 required to test thread safety' - unless $force or $] >= 5.013004; + unless $force or "$]" >= 5.013004; } use threads; @@ -43,7 +43,7 @@ sub run_perl { SKIP: { - skip 'Fails on 5.8.2 and lower' => 1 if $] <= 5.008002; + skip 'Fails on 5.8.2 and lower' => 1 if "$]" <= 5.008002; my $status = run_perl <<' RUN'; my ($code, @expected); diff --git a/t/50-external.t b/t/50-external.t index f8dca42..2b31829 100644 --- a/t/50-external.t +++ b/t/50-external.t @@ -24,7 +24,7 @@ sub run_perl { SKIP: { - skip 'Fixed in core only since 5.12' => 1 unless $] >= 5.012; + skip 'Fixed in core only since 5.12' => 1 unless "$]" >= 5.012; my $status = run_perl 'no indirect hook => sub { exit 2 }; new X'; is $status, 2 << 8, 'no semicolon at the end of -e'; }