fix infinite loop with empty comma
[bse.git] / t / 010-modules / 110-number.t
1 #!perl
2 use strict;
3 use BSE::Util::Format qw(bse_number);
4 use BSE::Cfg;
5 use Test::More;
6
7 {
8   my $cfg = BSE::Cfg->new_from_text(text => <<CFG);
9 [number money]
10 comma=,
11 divisor=100
12 places=2
13 CFG
14   is(BSE::Util::Format::bse_number("money", 1_000_000, $cfg), "10,000.00",
15      "smoke test the basics");
16 }
17
18 {
19   my $cfg = BSE::Cfg->new_from_text(text => <<CFG);
20 [number emptycomma]
21 comma=""
22 CFG
23   is(BSE::Util::Format::bse_number("emptycomma", 10000000, $cfg), "10000000",
24      "check empty comma doesn't infinite loop");
25 }
26
27 done_testing();