[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] Class::Date objects in scalar context perl 5.8.3 vs. 5.8.7? or something else?
Hi dLux --
I was wondering if you had any idea what is happening here off the top
of your head... Here's my test script:
$ cat j.t
use Test::More tests => 1;
use Class::Date qw(:errors -DateParse ) ;
my $d = Class::Date->new("2005-08-03");
print "$d\n";
is($d, "2005-08-03", "???");
Pretty straight-forward, right? Yet undef Perl 5.8.3 the test script
passes when it shouldn't?
$ /usr/bin/perl5.8.3 j.t
1..1
2005-08-03 00:00:00
ok 1 - ???
Perl 5.8.7 fails as expected:
$ /usr/bin/perl5.8.7 j.t
1..1
2005-08-03 00:00:00
not ok 1 - ???
# Failed test '???'
# in j.t at line 5.
# got: '2005-08-03 00:00:00'
# expected: '2005-08-03'
# Looks like you failed 1 test of 1.
And I'm having a hard time blaming Test::More, since this behaves as
expected under 5.8.3:
$ cat j.t
use Test::More tests => 1;
is("2005-08-03 00:00:00", "2005-08-03", "???");
$ /usr/bin/perl5.8.3 j.t
1..1
not ok 1 - ???
# Failed test (j.t at line 2)
# got: '2005-08-03 00:00:00'
# expected: '2005-08-03'
# Looks like you failed 1 test of 1.
So somewhere something is going wrong inside Test::More's use of your
string() overload in Class::Date? uhhh...
Any thoughts would be appreciated.
Thanks!
j