Subject: | t/96_is_deteministic_value.t incompatible with DateTime 0.53 |
It looks like you need to require a more recent version of DateTime.
With 0.53 installed (the default in yum in CentOS), it got the errors
below. I updated to the more recent DateTime 0.61 version and it works
fine. 0.53 stringification/numification overloading must not have
recognized the operator context correctly. Thanks. --mark--
{
my $formatter = DateTime::Format::Strptime->new(pattern => '%Y');
my $dt = DateTime->new(year => 2006, month => 06, day => 06,
formatter => $formatter );
my $cd;
lives_ok {
$cd = $cd_rs->search({ year => $dt})->create
({
artist => {name => 'Guillermo2'},
title => 'Guillermo 2',
});
};
my $year = $cd->year;
diag("year is '$year'");
diag("year reftype is '".ref($year)."'");
is($cd->year, 2006);
# ok($cd->year == 2006);
ok("$year" == 2006, 'stringify datetime before == comparison with an
integer');
is($cd->year, '2006', 'use Test::More::is to compare dt to string
"2006"');
ok($year eq '2006', 'use eq to compare dt to string "2006"');
}
hedges@vm5:~/src/DBIx-Class-0.08123$ prove -v t/96_is_deteministic_value.t
t/96_is_deteministic_value.t ..
ok 1
# year is '1999'
# year reftype is ''
ok 2
ok 3
# year is '2006'
# year reftype is 'DateTime'
not ok 4
# Failed test at t/96_is_deteministic_value.t line 48.
# got: '2006'
# expected: '2006'
ok 5 - stringify datetime before == comparison with an integer
not ok 6 - use Test::More::is to compare dt to string "2006"
# Failed test 'use Test::More::is to compare dt to string "2006"'
# at t/96_is_deteministic_value.t line 51.
# got: '2006'
# expected: '2006'
not ok 7 - use eq to compare dt to string "2006"
# Failed test 'use eq to compare dt to string "2006"'
# at t/96_is_deteministic_value.t line 52.
ok 8
ok 9
ok 10
ok 11
1..11
# Looks like you failed 3 tests of 11.
Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/11 subtests
Test Summary Report
-------------------
t/96_is_deteministic_value.t (Wstat: 768 Tests: 11 Failed: 3)
Failed tests: 4, 6-7
Non-zero exit status: 3
Files=1, Tests=11, 1 wallclock secs ( 0.01 usr 0.04 sys + 0.51 cusr
0.40 csys = 0.96 CPU)
Result: FAIL
hedges@vm5:~/src/DBIx-Class-0.08123$ prove -v t/96_is_deteministic_value.t
t/96_is_deteministic_value.t ..
ok 1
# year is '1999'
# year reftype is ''
ok 2
ok 3
# year is '2006'
# year reftype is 'DateTime'
ok 4
ok 5 - stringify datetime before == comparison with an integer
ok 6 - use Test::More::is to compare dt to string "2006"
ok 7 - use eq to compare dt to string "2006"
ok 8
ok 9
ok 10
ok 11
1..11
ok
All tests successful.
Files=1, Tests=11, 1 wallclock secs ( 0.02 usr 0.03 sys + 0.50 cusr
0.37 csys = 0.92 CPU)
Result: PASS