From 03a3256e9c62e38f2b35fa83c35be06fe2123fd2 Mon Sep 17 00:00:00 2001 From: Jakob Strobl Date: Fri, 28 Aug 2020 18:51:06 -0400 Subject: fix(std/encoding/toml): Comment after arrays causing incorrect output (#7224) --- std/encoding/toml_test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'std/encoding/toml_test.ts') diff --git a/std/encoding/toml_test.ts b/std/encoding/toml_test.ts index 9b5e1a56b..25c0d1113 100644 --- a/std/encoding/toml_test.ts +++ b/std/encoding/toml_test.ts @@ -413,3 +413,30 @@ the = "array" assertEquals(actual, expected); }, }); + +Deno.test({ + name: "[TOML] Comments", + fn: () => { + const expected = { + str0: "value", + str1: "# This is not a comment", + str2: + " # this is not a comment!\nA multiline string with a #\n# this is also not a comment", + str3: + '"# not a comment"\n\t# this is a real tab on purpose \n# not a comment', + point0: { x: 1, y: 2, str0: "#not a comment", z: 3 }, + point1: { x: 7, y: 8, z: 9, str0: "#not a comment" }, + deno: { + features: ["#secure by default", "supports typescript # not a comment"], + url: "https://deno.land/", + is_not_node: true, + }, + toml: { + name: "Tom's Obvious, Minimal Language", + objectives: ["easy to read", "minimal config file", "#not a comment"], + }, + }; + const actual = parseFile(path.join(testFilesDir, "comment.toml")); + assertEquals(actual, expected); + }, +}); -- cgit v1.2.3