Skip to content

Commit b486145

Browse files
authored
Merge pull request #1015 from book/fix-version-string-comparisons
fix string comparisons with $] to use numeric comparison instead
2 parents 4479a51 + 5ba7269 commit b486145

File tree

18 files changed

+22
-22
lines changed

18 files changed

+22
-22
lines changed

lib/Test2/API.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ sub CLONE {
7474

7575
BEGIN {
7676
no warnings 'once';
77-
if($] ge '5.014' || $ENV{T2_CHECK_DEPTH} || $Test2::API::DO_DEPTH_CHECK) {
77+
if("$]" >= 5.014 || $ENV{T2_CHECK_DEPTH} || $Test2::API::DO_DEPTH_CHECK) {
7878
*DO_DEPTH_CHECK = sub() { 1 };
7979
}
8080
else {

lib/Test2/Formatter/TAP.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ sub _open_handles {
6666
sub encoding {
6767
my $self = shift;
6868

69-
if ($] ge "5.007003" and @_) {
69+
if ("$]" >= 5.007003 and @_) {
7070
my ($enc) = @_;
7171
my $handles = $self->{+HANDLES};
7272

lib/Test2/Tools/Tiny.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use strict;
33
use warnings;
44

55
BEGIN {
6-
if ($] lt "5.008") {
6+
if ("$]" < 5.008) {
77
require Test::Builder::IO::Scalar;
88
}
99
}
@@ -260,7 +260,7 @@ sub capture(&) {
260260

261261
($ok, $e) = try {
262262
# Scalar refs as filehandles were added in 5.8.
263-
if ($] ge "5.008") {
263+
if ("$]" >= 5.008) {
264264
open($out_fh, '>', \$out) or die "Failed to open a temporary STDOUT: $!";
265265
open($err_fh, '>', \$err) or die "Failed to open a temporary STDERR: $!";
266266
}

t/HashBase.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ is($pkg->do_it, 'const', "worked as expected");
8484
}
8585
ok(!$pkg->FOO, "overrode const sub");
8686
{
87-
local $TODO = "known to fail on $]" if $] le "5.006002";
87+
local $TODO = "known to fail on $]" if "$]" <= 5.006002;
8888
is($pkg->do_it, 'const', "worked as expected, const was constant");
8989
}
9090

t/Legacy/Regression/736_use_ok.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sub capture(&) {
1919
}
2020

2121
{
22-
local $TODO = "known to fail on $]" if $] le "5.006002";
22+
local $TODO = "known to fail on $]" if "$]" <= 5.006002;
2323
my $file = __FILE__;
2424
my $line = __LINE__ + 4;
2525
like(

t/Legacy/overload_threads.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ BEGIN {
2020

2121
use Test::More;
2222

23-
plan skip_all => "known to crash on $]" if $] le "5.006002";
23+
plan skip_all => "known to crash on $]" if "$]" <= 5.006002;
2424

2525
plan tests => 5;
2626

t/Legacy_And_Test2/preload_diag_note.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33

4-
if ($] lt "5.008") {
4+
if ("$]" < 5.008) {
55
print "1..0 # SKIP Test cannot run on perls below 5.8.0\n";
66
exit 0;
77
}

t/Test2/behavior/init_croak.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BEGIN {
1414
}
1515
}
1616

17-
skip_all("known to fail on $]") if $] le "5.006002";
17+
skip_all("known to fail on $]") if "$]" <= 5.006002;
1818

1919
$@ = "";
2020
my ($file, $line) = (__FILE__, __LINE__ + 1);

t/Test2/behavior/nested_context_exception.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use Test2::Tools::Tiny;
55

66
use Test2::API qw/context/;
77

8-
skip_all("known to fail on $]") if $] le "5.006002";
8+
skip_all("known to fail on $]") if "$]" <= 5.006002;
99

1010
sub outer {
1111
my $code = shift;

t/Test2/modules/API.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ like(
114114
"got warning about adding driver too late"
115115
);
116116
};
117-
if ($] le "5.006002") {
117+
if ("$]" <= 5.006002) {
118118
todo("TODO known to fail on $]", $sub1);
119119
} else {
120120
$sub1->();

0 commit comments

Comments
 (0)