Skip to content

Commit bd368a8

Browse files
committed
Some tests for ignoring commas
1 parent 5f879b1 commit bd368a8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/parsing-test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ tape('functions', (test) => {
3434
test.end();
3535
});
3636

37+
tape('commas', (test) => {
38+
test.equal(str('1,1'), '11');
39+
test.equal(str('1,1 + 2,2'), '11 + 22');
40+
test.equal(str('1,000 + 2,000'), '1000 + 2000');
41+
test.equal(str('1,'), '1'); // Trailing comma
42+
// test.equal(str(',1'), '1'); // Leading comma TODO: failing
43+
test.equal(str('1,2,3'), '123'); // Multiple commas
44+
test.equal(str('1,234,567.89'), '1234567.89'); // Multiple commas with a decimal point
45+
test.equal(str('1,,2'), '12'); // Multiple consecutive commas
46+
test.equal(str('1,2,'), '12'); // Multiple commas with trailing
47+
test.end();
48+
});
49+
3750
tape('strings', (test) => {
3851
test.equal(str('"A" + "B"'), '"A" + "B"');
3952
test.equal(str('"A"_"B"'), '"A"_"B"');

0 commit comments

Comments
 (0)