Skip to content

Commit

Permalink
Update test cases from toml-test
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Jan 20, 2023
1 parent fcbab74 commit d73da82
Show file tree
Hide file tree
Showing 127 changed files with 1,438 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Invalid codepoint U+D800 : ���
1 change: 1 addition & 0 deletions internal/toml-test/tests/invalid/float/inf-capital.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v = Inf
1 change: 1 addition & 0 deletions internal/toml-test/tests/invalid/float/nan-capital.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v = NaN
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tbl = { a = 1, [b] }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tbl = { a.b = "a_b", a.b.c = "a_b_c" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tbl = { fruit = { apple.color = "red" }, fruit.apple.texture = { smooth = true } }

3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/spec/inline-table-2-0.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[product]
type = { name = "Nail" }
type.edible = false # INVALID
3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/spec/inline-table-3-0.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[product]
type.name = "Nail"
type = { edible = false } # INVALID
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
key = # INVALID
3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/spec/keys-2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
= "no key name" # INVALID
"" = "blank" # VALID but discouraged
'' = 'blank' # VALID but discouraged
7 changes: 7 additions & 0 deletions internal/toml-test/tests/invalid/spec/string-4-0.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
str4 = """Here are two quotation marks: "". Simple enough."""
str5 = """Here are three quotation marks: """.""" # INVALID
str5 = """Here are three quotation marks: ""\"."""
str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""

# "This," she said, "is just a pointless statement."
str7 = """"This," she said, "is just a pointless statement.""""
7 changes: 7 additions & 0 deletions internal/toml-test/tests/invalid/spec/string-7-0.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
quot15 = '''Here are fifteen quotation marks: """""""""""""""'''

apos15 = '''Here are fifteen apostrophes: '''''''''''''''''' # INVALID
apos15 = "Here are fifteen apostrophes: '''''''''''''''"

# 'That,' she said, 'is still pointless.'
str = ''''That,' she said, 'is still pointless.''''
9 changes: 9 additions & 0 deletions internal/toml-test/tests/invalid/spec/table-9-0.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[fruit]
apple.color = "red"
apple.taste.sweet = true

[fruit.apple] # INVALID
# [fruit.apple.taste] # INVALID

[fruit.apple.texture] # you can add sub-tables
smooth = true
9 changes: 9 additions & 0 deletions internal/toml-test/tests/invalid/spec/table-9-1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[fruit]
apple.color = "red"
apple.taste.sweet = true

# [fruit.apple] # INVALID
[fruit.apple.taste] # INVALID

[fruit.apple.texture] # you can add sub-tables
smooth = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[a.b]]

[a]
b.y = 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[fruit]
apple.color = "red"

[[fruit.apple]]
1 change: 1 addition & 0 deletions internal/toml-test/tests/valid/comment/nonascii.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions internal/toml-test/tests/valid/comment/nonascii.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ~ € ÿ ퟿  ￿ 𐀀 􏿿
22 changes: 22 additions & 0 deletions internal/toml-test/tests/valid/key/dotted-empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"": {
"x": {
"type": "string",
"value": "empty.x"
}
},
"x": {
"": {
"type": "string",
"value": "x.empty"
}
},
"a": {
"": {
"": {
"type": "string",
"value": "empty.empty"
}
}
}
}
4 changes: 4 additions & 0 deletions internal/toml-test/tests/valid/key/dotted-empty.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
''.x = "empty.x"
x."" = "x.empty"
[a]
"".'' = "empty.empty"
22 changes: 22 additions & 0 deletions internal/toml-test/tests/valid/key/quoted-unicode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"\u0000": {
"type": "string",
"value": "null"
},
"\\u0000": {
"type": "string",
"value": "different key"
},
"\b \f A \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \ud800\udc00 \udbff\udfff": {
"type": "string",
"value": "escaped key"
},
"~ \u0080 \u00ff \ud7ff \ue000 \uffff \ud800\udc00 \udbff\udfff": {
"type": "string",
"value": "basic key"
},
"l ~ \u0080 \u00ff \ud7ff \ue000 \uffff \ud800\udc00 \udbff\udfff": {
"type": "string",
"value": "literal key"
}
}
7 changes: 7 additions & 0 deletions internal/toml-test/tests/valid/key/quoted-unicode.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

"\u0000" = "null"
'\u0000' = "different key"
"\u0008 \u000c \U00000041 \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \U00010000 \U0010ffff" = "escaped key"

"~ € ÿ ퟿  ￿ 𐀀 􏿿" = "basic key"
'l ~ € ÿ ퟿  ￿ 𐀀 􏿿' = "literal key"
146 changes: 146 additions & 0 deletions internal/toml-test/tests/valid/spec/array-0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"colors": [
{
"type": "string",
"value": "red"
},
{
"type": "string",
"value": "yellow"
},
{
"type": "string",
"value": "green"
}
],
"contributors": [
{
"type": "string",
"value": "Foo Bar \u003cfoo@example.com\u003e"
},
{
"email": {
"type": "string",
"value": "bazqux@example.com"
},
"name": {
"type": "string",
"value": "Baz Qux"
},
"url": {
"type": "string",
"value": "https://example.com/bazqux"
}
}
],
"integers": [
{
"type": "integer",
"value": "1"
},
{
"type": "integer",
"value": "2"
},
{
"type": "integer",
"value": "3"
}
],
"nested_arrays_of_ints": [
[
{
"type": "integer",
"value": "1"
},
{
"type": "integer",
"value": "2"
}
],
[
{
"type": "integer",
"value": "3"
},
{
"type": "integer",
"value": "4"
},
{
"type": "integer",
"value": "5"
}
]
],
"nested_mixed_array": [
[
{
"type": "integer",
"value": "1"
},
{
"type": "integer",
"value": "2"
}
],
[
{
"type": "string",
"value": "a"
},
{
"type": "string",
"value": "b"
},
{
"type": "string",
"value": "c"
}
]
],
"numbers": [
{
"type": "float",
"value": "0.1"
},
{
"type": "float",
"value": "0.2"
},
{
"type": "float",
"value": "0.5"
},
{
"type": "integer",
"value": "1"
},
{
"type": "integer",
"value": "2"
},
{
"type": "integer",
"value": "5"
}
],
"string_array": [
{
"type": "string",
"value": "all"
},
{
"type": "string",
"value": "strings"
},
{
"type": "string",
"value": "are the same"
},
{
"type": "string",
"value": "type"
}
]
}
12 changes: 12 additions & 0 deletions internal/toml-test/tests/valid/spec/array-0.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
integers = [ 1, 2, 3 ]
colors = [ "red", "yellow", "green" ]
nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
string_array = [ "all", 'strings', """are the same""", '''type''' ]

# Mixed-type arrays are allowed
numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
contributors = [
"Foo Bar <foo@example.com>",
{ name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" }
]
26 changes: 26 additions & 0 deletions internal/toml-test/tests/valid/spec/array-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"integers2": [
{
"type": "integer",
"value": "1"
},
{
"type": "integer",
"value": "2"
},
{
"type": "integer",
"value": "3"
}
],
"integers3": [
{
"type": "integer",
"value": "1"
},
{
"type": "integer",
"value": "2"
}
]
}
8 changes: 8 additions & 0 deletions internal/toml-test/tests/valid/spec/array-1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
integers2 = [
1, 2, 3
]

integers3 = [
1,
2, # this is ok
]
29 changes: 29 additions & 0 deletions internal/toml-test/tests/valid/spec/array-of-tables-0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"products": [
{
"name": {
"type": "string",
"value": "Hammer"
},
"sku": {
"type": "integer",
"value": "738594937"
}
},
{},
{
"color": {
"type": "string",
"value": "gray"
},
"name": {
"type": "string",
"value": "Nail"
},
"sku": {
"type": "integer",
"value": "284758393"
}
}
]
}
11 changes: 11 additions & 0 deletions internal/toml-test/tests/valid/spec/array-of-tables-0.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[products]]
name = "Hammer"
sku = 738594937

[[products]] # empty table within the array

[[products]]
name = "Nail"
sku = 284758393

color = "gray"
Loading

0 comments on commit d73da82

Please sign in to comment.