Subject: | format_price.t assumes USD regardless of posix locale |
The format_price test code fails if you are using a locale currency other than USD
t/format_price.......FAILED tests 2-6
Failed 5/6 tests, 16.67% okay
This is easy to fix by forcing the currency unit in the test harness. Attatched is a diff -u patch against the latest Number::Format release
--- format_price.t 2001-12-10 20:35:59.000000000 +0000
+++ format_price2.t 2005-09-23 09:15:47.000000000 +0000
@@ -19,17 +19,19 @@
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):
-print "not " unless (format_price(123456.51) eq 'USD 123,456.51');
+my $usd = new Number::Format(-int_curr_symbol => 'USD');
+
+print "not " unless ($usd->format_price(123456.51) eq 'USD 123,456.51');
print "ok 2\n";
-print "not " unless (format_price(1234567.509) eq 'USD 1,234,567.51');
+print "not " unless ($usd->format_price(1234567.509) eq 'USD 1,234,567.51');
print "ok 3\n";
-print "not " unless (format_price(1234.51, 3) eq 'USD 1,234.510');
+print "not " unless ($usd->format_price(1234.51, 3) eq 'USD 1,234.510');
print "ok 4\n";
-print "not " unless (format_price(123456789.1) eq 'USD 123,456,789.10');
+print "not " unless ($usd->format_price(123456789.1) eq 'USD 123,456,789.10');
print "ok 5\n";
-print "not " unless (format_price(100, "0") eq 'USD 100');
+print "not " unless ($usd->format_price(100, "0") eq 'USD 100');
print "ok 6\n";