Subject: | Failure in t/oracle.t, line 73. |
Date: | Fri, 18 Dec 2015 17:12:27 -0800 |
To: | bug-Rose-DB [...] rt.cpan.org |
From: | George Hartzell <hartzell.george [...] gene.com> |
Testing using perl 5.18.4 on a Redhat 6 linux system with a recent
collection of CPAN modules, in particular Rose::DB 0.777,
DateTime::Format::Oracle 0.06, and Convert::NLS_DATE_FORMAT 0.05. Oracle is
11g.
The test at line 73 in t/oracle.t tries to parse a date like this:
2002-12-31 12:34:56.0
with a format like this:
YYYY-MM-DD HH24:MI:SS
which fails.
I don’t see any reason that the test should pass, there’s nothing in the
pattern to match the trailing .0 in the query string.
Here’s the test output:
georgewh@rescomp5006:Rose-DB-0.777 % prove -l t/oracle.t
t/oracle.t .. 1/80
# Failed test 'parse_datetime() 2'
# at t/oracle.t line 73.
# got: undef
# expected: '2002-12-31T12:34:56'
# Looks like you failed 1 test of 80.
t/oracle.t .. Dubious, test returned 1 (wstat 256, 0x100)
Here is the test that runs on that line:
is($db->parse_datetime('2002-12-31 12:34:56.0'),
parse_date('12/31/2002 12:34:56'), "parse_datetime() 2");
Here’ the code, from Rose::DB::Oracle, starting at line 564, that’s being
called; parse_datetime is just an alias for parse_date.
sub parse_date
{
my($self, $value) = @_;
local $DateTime::Format::Oracle::nls_date_format =
$ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS';
# Add or extend the time to appease DateTime::Format::Oracle
if($value =~ /\d\d:/)
{
$value =~ s/( \d\d:\d\d)([^:]|$)/$1:00$2/;
}
else
{
$value .= ' 00:00:00';
}
return DateTime::Format::Oracle->parse_date($value);
}
*parse_datetime = \&parse_date;
I believe that this test is incorrect.
g.