Skip to content

Commit d73da82

Browse files
committed
Update test cases from toml-test
1 parent fcbab74 commit d73da82

File tree

127 files changed

+1438
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1438
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Invalid codepoint U+D800 : ���
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v = Inf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v = NaN
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tbl = { a = 1, [b] }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tbl = { a.b = "a_b", a.b.c = "a_b_c" }
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tbl = { fruit = { apple.color = "red" }, fruit.apple.texture = { smooth = true } }
2+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[product]
2+
type = { name = "Nail" }
3+
type.edible = false # INVALID
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[product]
2+
type.name = "Nail"
3+
type = { edible = false } # INVALID
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
key = # INVALID
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
= "no key name" # INVALID
2+
"" = "blank" # VALID but discouraged
3+
'' = 'blank' # VALID but discouraged
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
str4 = """Here are two quotation marks: "". Simple enough."""
2+
str5 = """Here are three quotation marks: """.""" # INVALID
3+
str5 = """Here are three quotation marks: ""\"."""
4+
str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""
5+
6+
# "This," she said, "is just a pointless statement."
7+
str7 = """"This," she said, "is just a pointless statement.""""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
quot15 = '''Here are fifteen quotation marks: """""""""""""""'''
2+
3+
apos15 = '''Here are fifteen apostrophes: '''''''''''''''''' # INVALID
4+
apos15 = "Here are fifteen apostrophes: '''''''''''''''"
5+
6+
# 'That,' she said, 'is still pointless.'
7+
str = ''''That,' she said, 'is still pointless.''''
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[fruit]
2+
apple.color = "red"
3+
apple.taste.sweet = true
4+
5+
[fruit.apple] # INVALID
6+
# [fruit.apple.taste] # INVALID
7+
8+
[fruit.apple.texture] # you can add sub-tables
9+
smooth = true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[fruit]
2+
apple.color = "red"
3+
apple.taste.sweet = true
4+
5+
# [fruit.apple] # INVALID
6+
[fruit.apple.taste] # INVALID
7+
8+
[fruit.apple.texture] # you can add sub-tables
9+
smooth = true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[[a.b]]
2+
3+
[a]
4+
b.y = 2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[fruit]
2+
apple.color = "red"
3+
4+
[[fruit.apple]]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# ~ € ÿ ퟿  ￿ 𐀀 􏿿
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"": {
3+
"x": {
4+
"type": "string",
5+
"value": "empty.x"
6+
}
7+
},
8+
"x": {
9+
"": {
10+
"type": "string",
11+
"value": "x.empty"
12+
}
13+
},
14+
"a": {
15+
"": {
16+
"": {
17+
"type": "string",
18+
"value": "empty.empty"
19+
}
20+
}
21+
}
22+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
''.x = "empty.x"
2+
x."" = "x.empty"
3+
[a]
4+
"".'' = "empty.empty"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"\u0000": {
3+
"type": "string",
4+
"value": "null"
5+
},
6+
"\\u0000": {
7+
"type": "string",
8+
"value": "different key"
9+
},
10+
"\b \f A \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \ud800\udc00 \udbff\udfff": {
11+
"type": "string",
12+
"value": "escaped key"
13+
},
14+
"~ \u0080 \u00ff \ud7ff \ue000 \uffff \ud800\udc00 \udbff\udfff": {
15+
"type": "string",
16+
"value": "basic key"
17+
},
18+
"l ~ \u0080 \u00ff \ud7ff \ue000 \uffff \ud800\udc00 \udbff\udfff": {
19+
"type": "string",
20+
"value": "literal key"
21+
}
22+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
"\u0000" = "null"
3+
'\u0000' = "different key"
4+
"\u0008 \u000c \U00000041 \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \U00010000 \U0010ffff" = "escaped key"
5+
6+
"~ € ÿ ퟿  ￿ 𐀀 􏿿" = "basic key"
7+
'l ~ € ÿ ퟿  ￿ 𐀀 􏿿' = "literal key"
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"colors": [
3+
{
4+
"type": "string",
5+
"value": "red"
6+
},
7+
{
8+
"type": "string",
9+
"value": "yellow"
10+
},
11+
{
12+
"type": "string",
13+
"value": "green"
14+
}
15+
],
16+
"contributors": [
17+
{
18+
"type": "string",
19+
"value": "Foo Bar \u003c[email protected]\u003e"
20+
},
21+
{
22+
"email": {
23+
"type": "string",
24+
"value": "[email protected]"
25+
},
26+
"name": {
27+
"type": "string",
28+
"value": "Baz Qux"
29+
},
30+
"url": {
31+
"type": "string",
32+
"value": "https://example.com/bazqux"
33+
}
34+
}
35+
],
36+
"integers": [
37+
{
38+
"type": "integer",
39+
"value": "1"
40+
},
41+
{
42+
"type": "integer",
43+
"value": "2"
44+
},
45+
{
46+
"type": "integer",
47+
"value": "3"
48+
}
49+
],
50+
"nested_arrays_of_ints": [
51+
[
52+
{
53+
"type": "integer",
54+
"value": "1"
55+
},
56+
{
57+
"type": "integer",
58+
"value": "2"
59+
}
60+
],
61+
[
62+
{
63+
"type": "integer",
64+
"value": "3"
65+
},
66+
{
67+
"type": "integer",
68+
"value": "4"
69+
},
70+
{
71+
"type": "integer",
72+
"value": "5"
73+
}
74+
]
75+
],
76+
"nested_mixed_array": [
77+
[
78+
{
79+
"type": "integer",
80+
"value": "1"
81+
},
82+
{
83+
"type": "integer",
84+
"value": "2"
85+
}
86+
],
87+
[
88+
{
89+
"type": "string",
90+
"value": "a"
91+
},
92+
{
93+
"type": "string",
94+
"value": "b"
95+
},
96+
{
97+
"type": "string",
98+
"value": "c"
99+
}
100+
]
101+
],
102+
"numbers": [
103+
{
104+
"type": "float",
105+
"value": "0.1"
106+
},
107+
{
108+
"type": "float",
109+
"value": "0.2"
110+
},
111+
{
112+
"type": "float",
113+
"value": "0.5"
114+
},
115+
{
116+
"type": "integer",
117+
"value": "1"
118+
},
119+
{
120+
"type": "integer",
121+
"value": "2"
122+
},
123+
{
124+
"type": "integer",
125+
"value": "5"
126+
}
127+
],
128+
"string_array": [
129+
{
130+
"type": "string",
131+
"value": "all"
132+
},
133+
{
134+
"type": "string",
135+
"value": "strings"
136+
},
137+
{
138+
"type": "string",
139+
"value": "are the same"
140+
},
141+
{
142+
"type": "string",
143+
"value": "type"
144+
}
145+
]
146+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
integers = [ 1, 2, 3 ]
2+
colors = [ "red", "yellow", "green" ]
3+
nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
4+
nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
5+
string_array = [ "all", 'strings', """are the same""", '''type''' ]
6+
7+
# Mixed-type arrays are allowed
8+
numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
9+
contributors = [
10+
"Foo Bar <[email protected]>",
11+
{ name = "Baz Qux", email = "[email protected]", url = "https://example.com/bazqux" }
12+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"integers2": [
3+
{
4+
"type": "integer",
5+
"value": "1"
6+
},
7+
{
8+
"type": "integer",
9+
"value": "2"
10+
},
11+
{
12+
"type": "integer",
13+
"value": "3"
14+
}
15+
],
16+
"integers3": [
17+
{
18+
"type": "integer",
19+
"value": "1"
20+
},
21+
{
22+
"type": "integer",
23+
"value": "2"
24+
}
25+
]
26+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
integers2 = [
2+
1, 2, 3
3+
]
4+
5+
integers3 = [
6+
1,
7+
2, # this is ok
8+
]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"products": [
3+
{
4+
"name": {
5+
"type": "string",
6+
"value": "Hammer"
7+
},
8+
"sku": {
9+
"type": "integer",
10+
"value": "738594937"
11+
}
12+
},
13+
{},
14+
{
15+
"color": {
16+
"type": "string",
17+
"value": "gray"
18+
},
19+
"name": {
20+
"type": "string",
21+
"value": "Nail"
22+
},
23+
"sku": {
24+
"type": "integer",
25+
"value": "284758393"
26+
}
27+
}
28+
]
29+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[[products]]
2+
name = "Hammer"
3+
sku = 738594937
4+
5+
[[products]] # empty table within the array
6+
7+
[[products]]
8+
name = "Nail"
9+
sku = 284758393
10+
11+
color = "gray"

0 commit comments

Comments
 (0)