Skip to content

Commit 9bbaaec

Browse files
committed
Update toml-test
1 parent 8a54f3e commit 9bbaaec

30 files changed

+67
-17
lines changed

internal/toml-test/json.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build go1.16
2-
// +build go1.16
3-
41
package tomltest
52

63
import (

internal/toml-test/runner.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//go:generate ./gen-multi.py
2-
//go:build go1.16
3-
// +build go1.16
42

53
package tomltest
64

@@ -293,7 +291,7 @@ func (t Test) runValid(p Parser, fsys fs.FS) Test {
293291
}
294292
if t.Output == "" {
295293
// Special case: we expect an empty output here.
296-
if t.Path != "valid/empty-file" {
294+
if t.Path != "valid/empty-file" && t.Path != "valid/comment/noeol" {
297295
return t.fail("stdout is empty")
298296
}
299297
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# The following line contains a single carriage return control character
2+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bare-formfeed =
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bare-vertical-tab =

internal/toml-test/tests/invalid/control/comment-cr.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
comment-cr = "Carriage return in comment" #
1+
comment-cr = "Carriage return in comment" # a=1
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# time-hour = 2DIGIT ; 00-23
2+
d = 2006-01-01T24:00:00-00:00

internal/toml-test/tests/invalid/datetime/impossible-date.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
2+
# ; month/year
3+
d = 2006-01-32T00:00:00-00:00
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
2+
# ; month/year
3+
d = 2006-01-00T00:00:00-00:00
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# time-minute = 2DIGIT ; 00-59
2+
d = 2006-01-01T00:60:00-00:00
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# date-month = 2DIGIT ; 01-12
2+
d = 2006-13-01T00:00:00-00:00
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# date-month = 2DIGIT ; 01-12
2+
d = 2007-00-01T00:00:00-00:00
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second
2+
# ; rules
3+
d = 2006-01-01T00:00:61-00:00
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a={}
2+
# Inline tables are immutable and can't be extended
3+
[a.b]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a.b=0
2+
# Since table "a" is already defined, it can't be replaced by an inline table.
3+
a={}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
incomplete-bin = 0b
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
incomplete-hex = 0x
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
incomplete-oct = 0o
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] # INVALID
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[fruit]
2+
apple.taste.sweet = true
3+
4+
[fruit.apple.taste] # INVALID

internal/toml-test/tests/valid/comment/everywhere.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
"type": "integer",
55
"value": "42"
66
},
7-
"d": {
7+
"dt": {
88
"type": "datetime",
99
"value": "1979-05-27T07:32:12-07:00"
1010
},
11+
"d": {
12+
"type": "date-local",
13+
"value": "1979-05-27"
14+
},
1115
"more": [
1216
{
1317
"type": "integer",

internal/toml-test/tests/valid/comment/everywhere.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ more = [ # Comment
2424
] # Hopefully not.
2525

2626
# Make sure the space between the datetime and "#" isn't lexed.
27-
d = 1979-05-27T07:32:12-07:00 # c
27+
dt = 1979-05-27T07:32:12-07:00 # c
28+
d = 1979-05-27 # Comment
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+
# single comment without any eol characters
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"0": {
3+
"type": "string",
4+
"value": ""
5+
}
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# The following line should be an unescaped backslash followed by a Windows
2+
# newline sequence ("\r\n")
3+
0="""\
4+
"""

internal/toml-test/toml.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build go1.16
2-
// +build go1.16
3-
41
package tomltest
52

63
import (

toml_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,14 @@ func TestToml(t *testing.T) {
289289

290290
// TODO: fix this.
291291
"invalid/table/append-with-dotted*",
292-
"invalid/datetime/time-no-leads", // https://github.com/BurntSushi/toml/issues/320
293-
"invalid/control/bare-null", // https://github.com/BurntSushi/toml/issues/317
294-
"invalid/control/comment-cr", // https://github.com/BurntSushi/toml/issues/321
292+
"invalid/inline-table/add",
293+
"invalid/table/duplicate-key-dotted-table",
294+
"invalid/table/duplicate-key-dotted-table2",
295+
296+
"invalid/datetime/time-no-leads", // https://github.com/BurntSushi/toml/issues/320
297+
"invalid/control/bare-null", // https://github.com/BurntSushi/toml/issues/317
298+
"invalid/control/comment-cr", // https://github.com/BurntSushi/toml/issues/321
299+
"invalid/control/bare-cr",
295300
"invalid/string/multiline-bad-escape-3", // https://github.com/BurntSushi/toml/issues/322
296301
},
297302
}

0 commit comments

Comments
 (0)