diff options
-rw-r--r-- | tests/README.md | 10 | ||||
-rw-r--r-- | tests/errors/README.md | 7 | ||||
-rw-r--r-- | tests/interpretation/README.md | 3 | ||||
-rw-r--r-- | tests/location/README.md | 8 | ||||
-rw-r--r-- | tests/location/basic.locations.pom | 3 | ||||
-rw-r--r-- | tests/location/basic.pom | 6 | ||||
-rw-r--r-- | tests/parsing/README.md | 3 | ||||
-rw-r--r-- | tests/parsing/escape_sequences.flat.pom | 3 | ||||
-rw-r--r-- | tests/parsing/escape_sequences.pom | 3 | ||||
-rw-r--r-- | tests/parsing/strange_keys.flat.pom | 18 | ||||
-rw-r--r-- | tests/parsing/strange_keys.pom | 26 | ||||
-rw-r--r-- | tests/parsing/value_and_subkeys.flat.pom | 4 | ||||
-rw-r--r-- | tests/parsing/value_and_subkeys.pom | 5 | ||||
-rw-r--r-- | tests/schema/README.md | 0 |
14 files changed, 97 insertions, 2 deletions
diff --git a/tests/README.md b/tests/README.md index e69de29..414a46c 100644 --- a/tests/README.md +++ b/tests/README.md @@ -0,0 +1,10 @@ +# Tests for POM + +Each subdirectory of this directory contains a type of test for POM parsers. +They are described below: + +- `parsing/` — for testing that key-value pairs are correct +- `location/` — for testing that definition location of keys is correctly determined +- `errors/` — for testing that error conditions are detected and gracefully handled +- `interpretation/` — for testing that numbers, booleans, and lists are parsed correctly +- `schema/` — for testing that schemas are implemented correctly diff --git a/tests/errors/README.md b/tests/errors/README.md new file mode 100644 index 0000000..7351033 --- /dev/null +++ b/tests/errors/README.md @@ -0,0 +1,7 @@ +# Error tests + +These tests are for checking that error conditions are +detected and gracefully handled. + +Each test in this file has an error, +and should be rejected by a compliant parser. diff --git a/tests/interpretation/README.md b/tests/interpretation/README.md new file mode 100644 index 0000000..ad18e09 --- /dev/null +++ b/tests/interpretation/README.md @@ -0,0 +1,3 @@ +# Interpretation tests + +These tests check that booleans, numbers, floats, and lists are interpreted correctly. diff --git a/tests/location/README.md b/tests/location/README.md new file mode 100644 index 0000000..caa8b6a --- /dev/null +++ b/tests/location/README.md @@ -0,0 +1,8 @@ +# Location tests + +These tests are for checking that definition location information +is correctly recorded. + +Each test consists of a file `x.pom` and a file `x.locations.pom`. +For every key in `x.pom`, there’s a corresponding key in `x.locations.pom` +which is set to the line number where the key was defined in `x.pom`. diff --git a/tests/location/basic.locations.pom b/tests/location/basic.locations.pom new file mode 100644 index 0000000..fc163cc --- /dev/null +++ b/tests/location/basic.locations.pom @@ -0,0 +1,3 @@ +x = 6 +y = 4 +z = 1 diff --git a/tests/location/basic.pom b/tests/location/basic.pom new file mode 100644 index 0000000..7a9cbe2 --- /dev/null +++ b/tests/location/basic.pom @@ -0,0 +1,6 @@ +z = 3 + + +y = "100\r\n +" +x = `22.2` 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 diff --git a/tests/schema/README.md b/tests/schema/README.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/schema/README.md |