Hi All
Accidentally I've found a bug in Assert.pm:
my ($expected, $actual) = ('1foo', '1bar');
$self->assert_equals($expected, $actual);
The code above will not generate a failure. I traced module source, and
found that the reason is in is_numeric():
sub is_numeric {
my $str = shift;
local $^W;
return defined $str && ! ($str == 0 && $str !~ /[+-]?0(e0)?/);
}
for (qw(123foo 123 foo)) {
print "$_ is numeric\n" if is_numeric($_) ;
}
__OUTPUT__
123foo is numeric
123 is numeric
At the same time, assert_str_equals does it's job.
Best regards,
Dmitry.
|