# this is easy to confuse, so keep in mind: before this comment no s///, m//, concat or other strong ops on
# $amount. after this comment no +,-,*,/,abs. it will only introduce subtle bugs.
- $amount =~ s/0*$//; # cull trailing 0s
+ $amount =~ s/0*$// unless defined $places && $places == 0; # cull trailing 0s
my @d = map { s/\d//g; reverse split // } my $tmp = $myconfig->{numberformat}; # get delim chars
my @p = split(/\./, $amount); # split amount at decimal point
is($::form->format_amount($config, 1, -2), '1.00', 'negative places 3');
# bugs amd edge cases
+$config->{numberformat} = '1.000,00';
is($::form->format_amount({ numberformat => '1.000,00' }, 0.00005), '0,00005', 'messing with small numbers and no precision');
is($::form->format_amount({ numberformat => '1.000,00' }, undef), '0', 'undef');
is($::form->format_amount($config, 1.00), '1', 'autotrim to 0 places');
+is($::form->format_amount($config, 10), '10', 'autotrim does not harm integers');
+is($::form->format_amount($config, 10, 2), '10,00' , 'autotrim does not harm integers 2');
+is($::form->format_amount($config, 10, -2), '10,00' , 'autotrim does not harm integers 3');
+is($::form->format_amount($config, 10, 0), '10', 'autotrim does not harm integers 4');
+
+is($::form->format_amount($config, 0, 0), '0' , 'trivial zero');
# dash stuff