Skip to content

Commit

Permalink
Update toml-test
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Jan 12, 2022
1 parent 8a54f3e commit 9bbaaec
Show file tree
Hide file tree
Showing 30 changed files with 67 additions and 17 deletions.
3 changes: 0 additions & 3 deletions internal/toml-test/json.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.16
// +build go1.16

package tomltest

import (
Expand Down
4 changes: 1 addition & 3 deletions internal/toml-test/runner.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//go:generate ./gen-multi.py
//go:build go1.16
// +build go1.16

package tomltest

Expand Down Expand Up @@ -293,7 +291,7 @@ func (t Test) runValid(p Parser, fsys fs.FS) Test {
}
if t.Output == "" {
// Special case: we expect an empty output here.
if t.Path != "valid/empty-file" {
if t.Path != "valid/empty-file" && t.Path != "valid/comment/noeol" {
return t.fail("stdout is empty")
}
}
Expand Down
2 changes: 2 additions & 0 deletions internal/toml-test/tests/invalid/control/bare-cr.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The following line contains a single carriage return control character

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bare-formfeed =
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bare-vertical-tab =
2 changes: 1 addition & 1 deletion internal/toml-test/tests/invalid/control/comment-cr.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
comment-cr = "Carriage return in comment" #
comment-cr = "Carriage return in comment" # a=1
Expand Down
Binary file modified internal/toml-test/tests/invalid/control/control.multi
Binary file not shown.
2 changes: 2 additions & 0 deletions internal/toml-test/tests/invalid/datetime/hour-over.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# time-hour = 2DIGIT ; 00-23
d = 2006-01-01T24:00:00-00:00

This file was deleted.

3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/datetime/mday-over.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
# ; month/year
d = 2006-01-32T00:00:00-00:00
3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/datetime/mday-under.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
# ; month/year
d = 2006-01-00T00:00:00-00:00
2 changes: 2 additions & 0 deletions internal/toml-test/tests/invalid/datetime/minute-over.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# time-minute = 2DIGIT ; 00-59
d = 2006-01-01T00:60:00-00:00
2 changes: 2 additions & 0 deletions internal/toml-test/tests/invalid/datetime/month-over.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# date-month = 2DIGIT ; 01-12
d = 2006-13-01T00:00:00-00:00
2 changes: 2 additions & 0 deletions internal/toml-test/tests/invalid/datetime/month-under.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# date-month = 2DIGIT ; 01-12
d = 2007-00-01T00:00:00-00:00
3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/datetime/second-over.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second
# ; rules
d = 2006-01-01T00:00:61-00:00
3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/inline-table/add.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a={}
# Inline tables are immutable and can't be extended
[a.b]
3 changes: 3 additions & 0 deletions internal/toml-test/tests/invalid/inline-table/overwrite.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a.b=0
# Since table "a" is already defined, it can't be replaced by an inline table.
a={}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
incomplete-bin = 0b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
incomplete-hex = 0x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
incomplete-oct = 0o
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[fruit]
apple.color = "red"

[fruit.apple] # INVALID
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[fruit]
apple.taste.sweet = true

[fruit.apple.taste] # INVALID
6 changes: 5 additions & 1 deletion internal/toml-test/tests/valid/comment/everywhere.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
"type": "integer",
"value": "42"
},
"d": {
"dt": {
"type": "datetime",
"value": "1979-05-27T07:32:12-07:00"
},
"d": {
"type": "date-local",
"value": "1979-05-27"
},
"more": [
{
"type": "integer",
Expand Down
3 changes: 2 additions & 1 deletion internal/toml-test/tests/valid/comment/everywhere.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ more = [ # Comment
] # Hopefully not.

# Make sure the space between the datetime and "#" isn't lexed.
d = 1979-05-27T07:32:12-07:00 # c
dt = 1979-05-27T07:32:12-07:00 # c
d = 1979-05-27 # Comment
1 change: 1 addition & 0 deletions internal/toml-test/tests/valid/comment/noeol.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/noeol.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# single comment without any eol characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"0": {
"type": "string",
"value": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The following line should be an unescaped backslash followed by a Windows
# newline sequence ("\r\n")
0="""\
"""
3 changes: 0 additions & 3 deletions internal/toml-test/toml.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.16
// +build go1.16

package tomltest

import (
Expand Down
11 changes: 8 additions & 3 deletions toml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,14 @@ func TestToml(t *testing.T) {

// TODO: fix this.
"invalid/table/append-with-dotted*",
"invalid/datetime/time-no-leads", // https://github.com/BurntSushi/toml/issues/320
"invalid/control/bare-null", // https://github.com/BurntSushi/toml/issues/317
"invalid/control/comment-cr", // https://github.com/BurntSushi/toml/issues/321
"invalid/inline-table/add",
"invalid/table/duplicate-key-dotted-table",
"invalid/table/duplicate-key-dotted-table2",

"invalid/datetime/time-no-leads", // https://github.com/BurntSushi/toml/issues/320
"invalid/control/bare-null", // https://github.com/BurntSushi/toml/issues/317
"invalid/control/comment-cr", // https://github.com/BurntSushi/toml/issues/321
"invalid/control/bare-cr",
"invalid/string/multiline-bad-escape-3", // https://github.com/BurntSushi/toml/issues/322
},
}
Expand Down

0 comments on commit 9bbaaec

Please sign in to comment.