Subject: | test_numericness test fails on 0xF00 with Perl 5.30 |
$ perl -Ilib t/assert.t
STARTING TEST RUN
1..40
[...]
ok PASS test_assert_raises
not ok ERROR test_numericness
t/tlib/AssertTest.pm:48 - test_numericness(Class::Inner::__A26)
For string '0xF00', expect f but got t
ok PASS test_fail_assert_null
That's caused by a change in perl. Perl 5.28 handles it as a string:
$ perl -e 'print qq{YES\n} if q{0xF00} == 0'
YES
While perl 5.30 handles it as a number:
$ perl -e 'print qq{YES\n} if q{0xF00} == 0'
The failing test has a relevant notice at t/tlib/AssertTest.pm:37:
'0xF00' => 'f', # controversial? but if you +=10 then it's == 10
This change is a side effect of perl v5.29.1-85-gce6f496d72 commit. An attached patch adapts the test.
Subject: | Test-Unit-0.25-Adapt-tests-to-Perl-5.30.patch |
From 04f6b165bd158ccf156e220f6aaa33b58a15c175 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 3 Jun 2019 15:43:31 +0200
Subject: [PATCH] Adapt tests to Perl 5.30
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It seems Perl started to understand a numerical value of hexadecimal
strings like '0xF'. This happens since Perl commit:
commit ce6f496d720f6206455628425320badd95b07372 (HEAD, refs/bisect/bad)
Author: sisyphus <sisyphus1@optusnet.com.au>
Date: Wed Aug 1 22:33:38 2018 +1000
PATCH: [perl #41202] text->float gives wrong answer
This changes to use Perl_strtod() when available, and that turns out to
be the key to fixing this bug.
S_mulexp10() is removed from embed.fnc to avoid repeating the
complicated prerequisites for defining Perl_strtod(). This works
because this static function already was defined before use in
numeric.c, and always called in full form without using a macro.
James Keenan fixed a file permissions problem originally introduced by
this commit, but the fix has been squashed into it.
Signed-off-by: Petr PÃsaÅ <ppisar@redhat.com>
---
t/tlib/AssertTest.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/tlib/AssertTest.pm b/t/tlib/AssertTest.pm
index 42fa860..bd0820b 100644
--- a/t/tlib/AssertTest.pm
+++ b/t/tlib/AssertTest.pm
@@ -34,7 +34,7 @@ sub test_numericness {
my %tests =
( 1 => 't',
0 => 't',
- '0xF00' => 'f', # controversial? but if you +=10 then it's == 10
+ '0xF00' => ($] lt '5.02902') ? 'f' : 't',
'15e7' => 't',
'15E7' => 't',
"not 0" => 'f',
--
2.20.1