Subject: | Failing tests with price formatting and simple patch |
Hello,
I experienced some failing tests on Apple OS X, 10.4 with perl 5.8.6, with your
Number::Format 1.51.
Details:
Darwin hyperstation.local 8.7.1 Darwin Kernel Version 8.7.1: Wed Jun 7 16:19:56 PDT 2006;
root:xnu-792.9.72.obj~2/RELEASE_I386 i386 i386
This is perl, v5.8.6 built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
The problem was with t/format_price.t
Apparently the tests expected the currency symbol and the price to be separated by a single
space, the regular expression, however does not seem to handle the case where no white
space is present but we need the space separation anyway and providing the parameter as a
string as in the test would imply no trailing whitespace.
I am however unsure why this works for using the locale instead, does the locale definition
have trailing whitespace? - anyway, all tests pass with the included patch.
BTW, cool module :)
jonasbn
Subject: | Format.pm.patch |
--- Format.pm 2006-04-26 18:47:37.000000000 +0200
+++ /Users/jonasbn/Desktop/Format.pm 2006-09-07 21:24:20.000000000 +0200
@@ -643,7 +643,7 @@
$decimal .= '0'x($precision - length $decimal);
# Combine it all back together and return it.
- $self->{int_curr_symbol} =~ s/\s+$/ /;
+ $self->{int_curr_symbol} =~ s/\s*$/ /;
my $result = ($self->{int_curr_symbol} .
($precision ?
join($self->{mon_decimal_point}, $integer, $decimal) :