Skip Menu |

This queue is for tickets about the Test-Unit CPAN distribution.

Report information
The Basics
Id: 129738
Status: new
Priority: 0/
Queue: Test-Unit

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.25
Fixed in: (no value)



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
Dne Po 03.čen.2019 10:28:49, ppisar napsal(a): Show quoted text
> $ 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 >
[...] Show quoted text
> This change is a side effect of perl v5.29.1-85-gce6f496d72 commit. An > attached patch adapts the test.
And perl v5.31.3-12-g14d26b44a1 restored the behavior (RT#134230). Attached patch reflects that.
Subject: Test-Unit-0.25-Adapt-tests-to-Perl-5.30.patch
From 9ac12f1967e091b504ac426a70fb41af0d9d44c2 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 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. But it was recognized as a bug and the behavior was restored with: commit 14d26b44a1d7eee67837ec0ea8fb0368ac6fe33e Author: Tony Cook <tony@develop-help.com> Date: Tue Aug 20 15:43:05 2019 +1000 (perl #134230) don't interpret 0x, 0b when numifying strings 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..d58890c 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' => ($] gt '5.029001' && $] lt '5.031004') ? 't' : 'f', '15e7' => 't', '15E7' => 't', "not 0" => 'f', -- 2.21.0