From f63e631a8e110c7b0a54b8b55516ad3c2d75b626 Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 8 Sep 2025 22:03:14 -0400 Subject: Add more tests --- tests/parsing/README.md | 3 +-- tests/parsing/escape_sequences.flat.pom | 3 +++ tests/parsing/escape_sequences.pom | 3 +++ tests/parsing/strange_keys.flat.pom | 18 ++++++++++++++++++ tests/parsing/strange_keys.pom | 26 ++++++++++++++++++++++++++ tests/parsing/value_and_subkeys.flat.pom | 4 ++++ tests/parsing/value_and_subkeys.pom | 5 +++++ 7 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 tests/parsing/escape_sequences.flat.pom create mode 100644 tests/parsing/escape_sequences.pom create mode 100644 tests/parsing/strange_keys.flat.pom create mode 100644 tests/parsing/strange_keys.pom create mode 100644 tests/parsing/value_and_subkeys.flat.pom create mode 100644 tests/parsing/value_and_subkeys.pom (limited to 'tests/parsing') diff --git a/tests/parsing/README.md b/tests/parsing/README.md index d3389cf..2279c04 100644 --- a/tests/parsing/README.md +++ b/tests/parsing/README.md @@ -1,7 +1,6 @@ # Parsing tests -These tests only check that key-value pairs are parsed correctly. -They do not test merging, number/list parsing, or schema validation. +These tests are for checking that key-value pairs are parsed correctly. Each test `x` consists of two files, `x.pom` and `x.flat.pom`. These files should produce the exact same schema, but `x.flat.pom` is formatted diff --git a/tests/parsing/escape_sequences.flat.pom b/tests/parsing/escape_sequences.flat.pom new file mode 100644 index 0000000..e124d91 --- /dev/null +++ b/tests/parsing/escape_sequences.flat.pom @@ -0,0 +1,3 @@ +qvalue = "\x0a\x0d\x09\x5c\x22\x27\x60\\,\\☺☺☺\x60\x27" +bvalue = "\x0a\x0d\x09\x5c\x22\x27\x60\\,\\☺☺☺\x22\x27" +nvalue = "\\n\\r\\t\\u\\x\\," diff --git a/tests/parsing/escape_sequences.pom b/tests/parsing/escape_sequences.pom new file mode 100644 index 0000000..959c97c --- /dev/null +++ b/tests/parsing/escape_sequences.pom @@ -0,0 +1,3 @@ +qvalue = "\n\r\t\\\"\'\`\,\x5c\u{263a}\u{0263a}\u{00263A}`'" +bvalue = `\n\r\t\\\"\'\`\,\x5c\u{263a}\u{0263a}\u{00263A}"'` +nvalue = \n\r\t\u\x\, diff --git a/tests/parsing/strange_keys.flat.pom b/tests/parsing/strange_keys.flat.pom new file mode 100644 index 0000000..0bdc87c --- /dev/null +++ b/tests/parsing/strange_keys.flat.pom @@ -0,0 +1,18 @@ +- = "0" +* = "1" +**-** = "2" +/ = "3" +9.9 = "4" +-2 = "5" +7 = "6" +_ = "7" +__ = "8" +œ = "9" +̀ = "10" + = "11" +􂍅 = "12" +  = "13" +̀.􂍅 = "14" +*.* = "15" +-.- = "16" +0.0 = "17" diff --git a/tests/parsing/strange_keys.pom b/tests/parsing/strange_keys.pom new file mode 100644 index 0000000..a0e2cae --- /dev/null +++ b/tests/parsing/strange_keys.pom @@ -0,0 +1,26 @@ +- = 0 +* = 1 +**-** = 2 +/ = 3 +9.9 = 4 +-2 = 5 +7 = 6 +_ = 7 +__ = 8 +œ = 9 +# combining grave accent +̀ = 10 +# U+E000 (in Private Use Area) + = 11 +# U+102345 (in Private Use Area) +􂍅 = 12 +# non breaking space +  = 13 +[̀] +􂍅 = 14 +[*] +* = 15 +[-] +- = 16 +[0] +0 = 17 diff --git a/tests/parsing/value_and_subkeys.flat.pom b/tests/parsing/value_and_subkeys.flat.pom new file mode 100644 index 0000000..efce989 --- /dev/null +++ b/tests/parsing/value_and_subkeys.flat.pom @@ -0,0 +1,4 @@ +one = "1" +one.one = "1!!" +one.two = "2" +one.two.three = "3" diff --git a/tests/parsing/value_and_subkeys.pom b/tests/parsing/value_and_subkeys.pom new file mode 100644 index 0000000..7b89203 --- /dev/null +++ b/tests/parsing/value_and_subkeys.pom @@ -0,0 +1,5 @@ +one = 1 +one.one = 1!! +one.two = 2 +[one.two] +three = 3 -- cgit v1.2.3