Subject: | Test-Needs only knows about Perl 5 major version |
This issue was discovered by kid51 while doing some test with a binary using the version 7.0.0
Which then leads to using 6.999 in the unit test t/find_missing.t
This is coming when doing eval q[v6.999.0] for example. Note: same issue with q[5.999.0]
I've attached a patch to solve and teach _numify_version more than 5.
Thanks for considering a fix for it.
nicolas
sample of the errors
```
$ prove7 -vb t/find_missing.t
t/find_missing.t ..
1..24
ok 1 - perl prereq of 6.999 passed
ok 2 - perl prereq of "6.999.0" passed
ok 3 - perl prereq of "v6.999.0" passed
Wide character in die at /usr/home/jkeenan/.cpan/build/Test-Needs-0.002006-3/blib/lib/Test/Needs.pm line 46.
version "�ϧ" does not look like a number at t/find_missing.t line 26.
# Looks like your test exited with 255 just after 3.
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 21/24 subtests
Test Summary Report
-------------------
t/find_missing.t (Wstat: 65280 Tests: 3 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 24 tests but ran 3.
Files=1, Tests=3, 0 wallclock secs ( 0.05 usr 0.01 sys + 0.07 cusr 0.00 csys = 0.12 CPU)
Result: FAIL
```
Subject: | 0001-Teach-more-versioning-than-5-to-_numify_version.patch |
From 6198f104496f0acb21162bb2b600a39de01e249b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=98=A2=20=E2=84=95icolas=20=E2=84=9D?=
<nicolas@atoomic.org>
Date: Mon, 3 Aug 2020 17:27:28 -0600
Subject: [PATCH] Teach more versioning than 5 to _numify_version
---
lib/Test/Needs.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/Test/Needs.pm b/lib/Test/Needs.pm
index f3337a3..c50e139 100644
--- a/lib/Test/Needs.pm
+++ b/lib/Test/Needs.pm
@@ -61,8 +61,10 @@ sub _numify_version {
: /^[0-9]+\.[0-9]+$/ ? sprintf('%.6f', $_)
: /^v?([0-9]+(?:\.[0-9]+)+)$/
? sprintf('%d.%03d%03d', ((split /\./, $1), 0, 0)[0..2])
- : /^(\x05)(.*)$/s
+ : /^(\x05|\x06|\x07)(.*)$/s
? sprintf('%d.%03d%03d', map ord, $1, split //, $2)
+ : $_ =~ m{^([0-9]+)$}
+ ? sprintf('%d.%03d%03d', $1, 0, 0)
: _croak qq{version "$_" does not look like a number};
}
}
--
2.24.3 (Apple Git-128)