Subject: | Time::Format 1.12 - Unit tests t/docs.t, t/funcs.t and t/manip.t fail |
Date: | Sat, 18 Oct 2014 19:02:30 +0200 |
To: | bug-Time-Format [...] rt.cpan.org |
From: | Olaf <japhno [...] gmail.com> |
Hi!
Three tests fail while running the test suite for Time::Format 1.12 in
case Date::Manip is installed. This is due to a bug in the affected test
scripts. See the suggested patches below.
Here is what happened on my machine (Perl 5.14.2) and Date:Manip 6.47
being available:
Creating new 'Build' script for 'Time-Format' version '1.12'
Building Time-Format
ROODE/Time-Format-1.12.tar.gz
./Build -- OK
Running Build test
t/0-signature.t .. ok
t/1-load.t ....... ok
t/DateManip.t .... ok
t/DateTime.t ..... ok
t/die.t .......... ok
Undefined subroutine in sort at
/sftw/perl/pmp-r5.14.2.1.0/lib/Date/Manip/TZ.pm line 1494, <DATA> line 1.
# Looks like you planned 26 tests but ran 23.
# Looks like your test exited with 255 just after 23.
t/doc.t ..........
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/26 subtests
t/epoch.t ........ ok
t/export1.t ...... ok
t/export2.t ...... ok
t/export3.t ...... ok
Undefined subroutine in sort at
/sftw/perl/pmp-r5.14.2.1.0/lib/Date/Manip/TZ.pm line 1494, <DATA> line 1.
# Looks like you planned 18 tests but ran 12.
# Looks like your test exited with 255 just after 12.
t/funcs.t ........
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 6/18 subtests
t/locale.t ....... ok
Undefined subroutine in sort at
/sftw/perl/pmp-r5.14.2.1.0/lib/Date/Manip/TZ.pm line 1494.
# Looks like you planned 6 tests but ran 1.
# Looks like your test exited with 255 just after 1.
t/manip.t ........
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/6 subtests
t/msec.t ......... ok
t/past.t ......... ok
t/quot.t ......... ok
t/strftime.t ..... ok
t/string.t ....... ok
t/time.t ......... ok
t/xs_DateTime.t .. ok
t/xs_doc.t ....... ok
t/xs_funcs.t ..... ok
t/xs_locale.t .... ok
t/xs_quot.t ...... ok
t/xs_time.t ...... ok
It happened, because %INC and the symbol table are mistakenly cleaned
after Date::Manip had been loaded successfully. Later when %manip is to
be tested, it cannot work, because everything related to Date::Manip has
been wiped out.
After fixing that all tests passed as expected, e.g.
$ perl -Ilib -MCarp::Always t/funcs.t
1..18
ok 1 - use Time::Format;
ok 2 - month: mm
ok 3 - m minute: 1
ok 4 - uc month name
ok 5 - lc weekday
ok 6 - time_format equals %time
ok 7 - day of month
ok 8 - Month number
ok 9 - minute
ok 10 - hour
ok 11 - year
ok 12 - time_strftime equals %time
ok 13 - year
ok 14 - day of month
ok 15 - %D
ok 16 - spaced day
ok 17 - hour
ok 18 - time_manip equals %time
I suggest the following patches:
$ cat doc.t.patch funcs.t.patch manip.t.patch
--- doc.t~ 2012-09-27 18:32:39.000000000 +0200
+++ doc.t 2014-10-18 18:08:12.949430255 +0200
@@ -14,13 +14,17 @@
BEGIN
{
$dm_notok = eval('use Date::Manip (); 1')? 0 : 1;
- unless ($dm_notok)
+ if ($dm_notok)
+ {
+ # Clean up %INC and symbol table
+ delete $INC{'Date/Manip.pm'};
+ %Date::Manip:: = ();
+ }
+ else
{
# If Date::Manip can't determine the time zone, it'll bomb out
of the tests.
$dm_notz = eval('Date::Manip::Date_TimeZone (); 1')? 0 : 1;
}
- delete $INC{'Date/Manip.pm'};
- %Date::Manip:: = ();
}
# Were all variables imported? (3)
--- funcs.t~ 2012-09-27 18:32:39.000000000 +0200
+++ funcs.t 2014-10-18 17:03:16.345329214 +0200
@@ -17,13 +17,17 @@
my $manip_notz;
BEGIN {
$manip_bad = eval('use Date::Manip (); 1')? 0 : 1;
- unless ($manip_bad)
+ if ($manip_bad)
+ {
+ # Clean up %INC and symbol table
+ delete $INC{'Date/Manip.pm'};
+ %Date::Manip:: = ();
+ }
+ else
{
# If Date::Manip can't determine the time zone, it'll bomb out
of the tests.
$manip_notz = eval ('Date::Manip::Date_TimeZone (); 1')? 0 : 1;
}
- delete $INC{'Date/Manip.pm'};
- %Date::Manip:: = ();
}
# Get day/month names in current locale
--- manip.t~ 2012-09-27 18:32:39.000000000 +0200
+++ manip.t 2014-10-18 17:07:57.145336495 +0200
@@ -18,8 +18,11 @@
$manip_bad = 'Date::Manip cannot determine time zone'
unless eval 'Date::Manip::Date_TimeZone(); 1';
}
- delete $INC{'Date/Manip.pm'};
- %Date::Manip:: = ();
+ if ($manip_bad) {
+ # Clean up %INC and symbol table
+ delete $INC{'Date/Manip.pm'};
+ %Date::Manip:: = ();
+ }
}
my $t = 'first thursday in june 2003';
The patch files are also attached to this report.
Best regards,
Olaf
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.