Skip to content

Commit

Permalink
test(yaml): add parse() test for duplicate keys (#5240)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored Jul 2, 2024
1 parent 5803cc9 commit 9c9ed80
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions yaml/parse_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,3 +784,16 @@ Deno.test("parse() throws with empty mapping key", () => {
"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 3:\n ? : 1\n ^",
);
});

Deno.test("parse() throws on duplicate keys", () => {
assertThrows(
() =>
parse(
`name: John Doe
age: 30
name: Jane Doe`,
),
YamlError,
"duplicated mapping key at line 3, column 1:\n name: Jane Doe\n ^",
);
});

0 comments on commit 9c9ed80

Please sign in to comment.