From 947ab3f90a7124c0c700a5b39826c6072974e16b Mon Sep 17 00:00:00 2001 From: Allen Date: Sat, 25 Apr 2020 09:43:46 +0800 Subject: [PATCH] add test for trailing comma in inline table (#366) Fixes #359 --- parser_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/parser_test.go b/parser_test.go index 65d11b0..4c5a65e 100644 --- a/parser_test.go +++ b/parser_test.go @@ -696,6 +696,13 @@ func TestInlineTableDoubleComma(t *testing.T) { } } +func TestInlineTableTrailingComma(t *testing.T) { + _, err := Load("foo = {hello = 53, foo = 17,}") + if err.Error() != "(1, 28): trailing comma at the end of inline table" { + t.Error("Bad error message:", err.Error()) + } +} + func TestDuplicateGroups(t *testing.T) { _, err := Load("[foo]\na=2\n[foo]b=3") if err.Error() != "(3, 2): duplicated tables" {