On Tue, Feb 22, 2011 at 3:51 AM, Lee Goddard <lee...@gmail.com> wrote: > Hello list, > > Does anyone know why the below is an error? > > # Failed test '-1 scalar' > # at t/Time-Simple.t line 153. > # got: '23:59:59' > # expected: '23:59:59' > # Looks like you failed 1 test of 100. > > ---- > http://www.cpantesters.org/cpan/report/b5243d96-38ec-11e0-afb0-adca6bb533f3
Looking just at the test, the offending lines appears to be: isa_ok($prevhour, 'Time::Simple'); is($prevhour, '23:59:59', '-1 scalar'); # this is the fail You've got an object compared to a string. When you see "got/expected" though, you're getting a stringification of the object. I would think those are the same, but maybe there's something funny in how is() treats objects. It's probably using the objects comparison override. I would make the stringification explicit if that's what you want: is("$prevhour", '23:59:59', '-1 scalar'); Or make the comparison explicit if that's what you want: ok( $prevhour eq '23:59:59', "-1 scalar"); is( $prevhour cmp '23:59:59', 0, "-1 scalar"); -- David