Skip to content

Commit 5bb02be

Browse files
Add test for trailing comma with leading and trailing whitespace
1 parent 50a28ec commit 5bb02be

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/json.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,23 @@ suite("JSON", () => {
267267

268268
result.should.equal(expected);
269269
});
270+
271+
test("ignore trailing comma in object member list with leading and trailing whitespace", () => {
272+
const text =
273+
`{
274+
"obj": { "a" : 1 , }
275+
}`;
276+
277+
const expected =
278+
`{
279+
"obj": {
280+
"a": 1
281+
}
282+
}`;
283+
284+
let json = tolerantParse(text);
285+
let result = JSON.stringify(json, null, 4);
286+
287+
result.should.equal(expected);
288+
});
270289
});

0 commit comments

Comments
 (0)