mirror of https://github.com/kdl-org/kdl.git
bring over test suite from kdl4j
This commit is contained in:
parent
129812543f
commit
164d2d202e
|
|
@ -32,6 +32,14 @@ free to jump in and give us your 2 cents!
|
||||||
* PHP: [kdl-php](https://github.com/kdl-org/kdl-php)
|
* PHP: [kdl-php](https://github.com/kdl-org/kdl-php)
|
||||||
* Python: [kdl-py](https://github.com/daeken/kdl-py)
|
* Python: [kdl-py](https://github.com/daeken/kdl-py)
|
||||||
|
|
||||||
|
## Compatibility Test Suite
|
||||||
|
|
||||||
|
There is a [compatibility test suite](tests/README.md) available for KDL
|
||||||
|
implementors to check that their implementations are actually spec-compatible.
|
||||||
|
|
||||||
|
The implementations above are not guaranteed to pass this test suite in its
|
||||||
|
entirety, but in the future, may be required to in order to be included here.
|
||||||
|
|
||||||
## Editor Support
|
## Editor Support
|
||||||
|
|
||||||
* [VS Code](https://marketplace.visualstudio.com/items?itemName=kdl-org.kdl&ssr=false#review-details)
|
* [VS Code](https://marketplace.visualstudio.com/items?itemName=kdl-org.kdl&ssr=false#review-details)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
# Full Document Test Cases
|
||||||
|
|
||||||
|
The `input` folder contains test cases for KDL parsers. The `expected_kdl`
|
||||||
|
folder contains files with the same name as those in `input` with the expected
|
||||||
|
output after being run through the parser and printed out again. If there's no
|
||||||
|
file in `expected_kdl` with a name corresponding to one in `input` it
|
||||||
|
indicates that parsing for that case should fail.
|
||||||
|
|
||||||
|
By necessity, the files in `expected_kdl` are not identical to their
|
||||||
|
corresponding inputs. They are instead pretty-printed according to the
|
||||||
|
following rules:
|
||||||
|
|
||||||
|
* All comments removed
|
||||||
|
* Extra empty lines removed except for a newline after the last node
|
||||||
|
* All nodes should be reformatted without escaped newlines
|
||||||
|
* Node fields should be `identifier <args in same order> <properties in alpha order by key> <children if non-empty>`
|
||||||
|
* All strings must be represented as regular strings, with appropriate escapes
|
||||||
|
for invalid bare characters. That means that raw strings must be converted
|
||||||
|
to plain strings, and escaped.
|
||||||
|
* Any literal newlines or other ascii escape characters in escaped strings
|
||||||
|
replaced with their escape sequences.
|
||||||
|
* All identifiers must be unquoted unless they _must_ be quoted. That means
|
||||||
|
`"foo"` becomes `foo`, and `"foo bar"` stays that way.
|
||||||
|
* Any duplicate properties must be removed, with only the rightmost one
|
||||||
|
remaining. This also means duplicate properties must be allowed.
|
||||||
|
* 4 space indents
|
||||||
|
* All numbers must be converted to their simplest decimal representation. That
|
||||||
|
means that hex, octal, and binary must all be converted to decimals. All
|
||||||
|
floats must be represented using `E` notation, with a single digit left of
|
||||||
|
the decimal point if the float is less than 1. While parsers are required to
|
||||||
|
_consume_ different number syntaxes, they are under no obligation to
|
||||||
|
represent numbers in any particular way.
|
||||||
|
|
||||||
|
Data may be manipulated as you wish in order to output the expected KDL. This
|
||||||
|
test suite verifies the ability to **parse**, not specific quirks about
|
||||||
|
internal representations.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "\"\\\/\b\f\n\r\t"
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
node "arg" prop="val" {
|
||||||
|
inner_node
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg" arg="val"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
😁 "happy!"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0b10
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0b10
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0b10
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node false true
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node prop1=true prop2=false
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg2"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node_2
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node_2
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node1
|
||||||
|
node2
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "😀"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
"" "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node ""="empty"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node ""
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "hello\nworld"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "hello\nworld"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node1
|
||||||
|
node2
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg" "arg2\n"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node1
|
||||||
|
node2
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0xabcdef1234567890
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0xabcdef0123456789abcdef
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0xabcdef0123
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0x1
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 1234
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
node {
|
||||||
|
inner_node
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0b1
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 11
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0o1
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg1" "arg2"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node " hey\neveryone\nhow goes?\n"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 1.0E-10
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node -1.0 key=-10.0
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node -10 prop=-15
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
node1 {
|
||||||
|
node2 {
|
||||||
|
node
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node1
|
||||||
|
node2
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 1E+10
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node false
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node true
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node null
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node prop=null
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 15.7
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node prop=10.0
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 0o76543210
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 1 1.0 1.0E+10 1.0E-10 0x1 0o7 0b10 "arg" "arg\\\\" true false null
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 1.0E+10
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node 10
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
"0node"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node prop="10.0"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "0prop"="val"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
r "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
"\\node"
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
node_1 "arg\\n"
|
||||||
|
node_2 "\"arg\\n\"and stuff"
|
||||||
|
node_3 "#\"arg\\n\"#and stuff"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "\\n"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "#"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "\\"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "\""
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "\"#\"##"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "\nhello\nworld\n"
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
node_1 prop="arg\\n"
|
||||||
|
node_2 prop="\"arg\"\\n"
|
||||||
|
node_3 prop="#\"arg\"#\\n"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "a\"b"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "arg" "arg"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node prop=11
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node "whee" "whee"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
node
|
||||||
|
node
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node prop=1.23E+1000
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
node prop=1.23E-1000
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
node {
|
||||||
|
childnode
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue