fix(std/encoding/toml): Comment after arrays causing incorrect output (#7224)

This commit is contained in:
Jakob Strobl 2020-08-28 18:51:06 -04:00 committed by GitHub
parent 935c92800f
commit 03a3256e9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 128 additions and 32 deletions

View file

@ -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);
},
});