[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Class::Date objects in scalar context perl 5.8.3 vs. 5.8.7? or something else?



dlux's response...

j
 

-----Original Message-----
From: Balázs Szabó [mailto:dlux@dlux.hu] 
Sent: Sunday, January 15, 2006 8:52 AM
To: Jay Hannah
Cc: omaha-pm@pm.org
Subject: Re: Class::Date objects in scalar context perl 5.8.3 vs. 5.8.7? or something else?

Hi,

Since the comparison of a Class::Date object and another thing  
(string, another Class::Date object, etc) is done with the internal  
"compare" function, then it should return "ok".

I have no clue why you got "not ok" in perl 5.8.7, I have just tested  
it on perl 5.8.6 on OS X and perl 5.8.7 on Linux, and both return "ok".

Regards,

dLux

On 2005.12.29., at 15:24, Jay Hannah wrote:

>
> 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
>
>

Balázs Szabó (dLux)
--   --  - - - -- -