diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2016-07-25 21:30:34 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2016-07-27 22:01:00 -0400 |
commit | dbdc20d774da8ae76ef23ff9daa4aa4211e23fc2 (patch) | |
tree | d2f23b67c7ae0b8be6036e9e65498b07ca1e2b6b /t/op/sprintf.t | |
parent | 3a34ca0bce7835211b45e070373cf653c253636a (diff) | |
download | perl-dbdc20d774da8ae76ef23ff9daa4aa4211e23fc2.tar.gz |
[perl #128630] follow-up on 6151d433
- test explicitly for $^O equivalence (faster, simpler),
as suggested in #126380
- allow also \b-/i match of archname
- however, do not explicitly anchor the archname,
as suggested in #126380, since if the regexp needs that, it can do so
- \Q-\E-protect the $^O, for paranoia
- for skip, use test.pl skip() instead of ok(1),
pointed out privately by Dan Collins
- drop the newly added /xxx/ functionality to simplify things
Diffstat (limited to 't/op/sprintf.t')
-rw-r--r-- | t/op/sprintf.t | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/t/op/sprintf.t b/t/op/sprintf.t index 04fc4ce6b7..5fd9bfdc3c 100644 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -113,23 +113,20 @@ for (@tests) { my $osv = exists $Config{osvers} ? $Config{osvers} : "0"; my $archname = $Config{archname}; # >comment skip: all< - if ($os =~ /\ball\b/i) { - $skip = 1; - } elsif ($os =~ /\b$^O(?::(\S+))?\b/i) { + # >comment skip: solaris< + # >comment skip: x86_64-linux-ld< + if ($os =~ /\b(?:all|\Q$^O\E|\Q$archname\E)\b/i) { + $skip = 1; + } elsif ($os =~ /\b\Q$^O\E(?::(\S+))\b/i) { # We can have the $^O followed by an optional condition. # The condition, if present, can be one of: - # (1) a regex between slashes... - # tested as a regex against $Config{archname} - # (2) starts with a digit... + # (1) starts with a digit... # the first pair of dot-separated digits is - # tested against $Config{osvers} - # (3) tested as literal string against $Config{archname} + # tested numerically against $Config{osvers} + # (2) otherwise... + # tested as a \b/i regex against $Config{archname} my $cond = $1; - if ($cond =~ m{^/(.+)/$}) { - # >comment skip: solaris:/86/< - my $vsr = $1; - $skip = $archname =~ /$vsr/; - } elsif ($cond =~ /^\d/) { + if ($cond =~ /^\d/) { # >comment skip: hpux:10.20< my $vsn = $cond; # Only compare on the the first pair of digits, as numeric @@ -138,7 +135,7 @@ for (@tests) { $skip = $vsn ? ($osv <= $vsn ? 1 : 0) : 1; } else { # >comment skip: netbsd:vax-netbsd< - $skip = $cond eq $archname; + $skip = $archname =~ /\b\Q$cond\E\b/i; } } $skip and $comment =~ s/$/, failure expected on $^O $osv $archname/; @@ -148,7 +145,7 @@ for (@tests) { ok(1, join ' ', grep length, ">$result<", $comment); } elsif ($skip) { - ok(1, "skip $comment"); + SKIP: { skip($comment, 1) } } elsif ($y eq ">$result<") # Some C libraries always give { # three-digit exponent |