Skip to content

Commit

Permalink
Add test for multiline tables
Browse files Browse the repository at this point in the history
Fixes #119
  • Loading branch information
arp242 committed Jan 16, 2023
1 parent 102e04e commit 6087694
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/BurntSushi/toml-test
go 1.16

require (
github.com/BurntSushi/toml v1.2.2-0.20230112133702-08a2344b20c3
github.com/BurntSushi/toml v1.2.2-0.20230116181612-fcbab7400715
// no_term branch, which doesn't depend on x/term and x/sys
zgo.at/zli v0.0.0-20220603144954-fdab8cc4d9d8
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/BurntSushi/toml v1.2.2-0.20230112133702-08a2344b20c3 h1:LDBapqEzAGbmjAvTfOZMLFuqiAvDx300rniVAB5MAFk=
github.com/BurntSushi/toml v1.2.2-0.20230112133702-08a2344b20c3/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.2.2-0.20230116181612-fcbab7400715 h1:wpQ/gpMTRuiaIOlcOImLxe7XF7FQ/Q5vmrQDEAHpGmI=
github.com/BurntSushi/toml v1.2.2-0.20230116181612-fcbab7400715/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
zgo.at/zli v0.0.0-20220603144954-fdab8cc4d9d8 h1:Cvmn2mATNsxwIVjKv91UHWdInUqjA/oWMH9kAUuzojQ=
zgo.at/zli v0.0.0-20220603144954-fdab8cc4d9d8/go.mod h1:HLAc12TjNGT+VRXr76JnsNE3pbooQtwKWhX+RlDjQ2Y=
50 changes: 50 additions & 0 deletions tests/valid/inline-table/newline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"tbl-1": {
"1": {
"type": "integer",
"value": "2"
},
"arr": [
{
"type": "integer",
"value": "1"
},
{
"type": "integer",
"value": "2"
},
{
"type": "integer",
"value": "3"
}
],
"hello": {
"type": "string",
"value": "world"
},
"tbl": {
"k": {
"type": "integer",
"value": "1"
}
}
},
"tbl-2": {
"k": {
"type": "string",
"value": "\tHello\n\t"
}
},
"trailing-comma-1": {
"c": {
"type": "integer",
"value": "1"
}
},
"trailing-comma-2": {
"c": {
"type": "integer",
"value": "1"
}
}
}
24 changes: 24 additions & 0 deletions tests/valid/inline-table/newline.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# TOML 1.1 supports newlines in inline tables and trailing commas.

trailing-comma-1 = {
c = 1,
}
trailing-comma-2 = { c = 1, }

tbl-1 = {
hello = "world",
1 = 2,
arr = [1,
2,
3,
],
tbl = {
k = 1,
}
}

tbl-2 = {
k = """
Hello
"""
}
6 changes: 6 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ var versions = map[string]versionSpec{
exclude: []string{
"invalid/datetime/no-secs", // Times without seconds is no longer invalid.
"invalid/string/basic-byte-escapes", // \x is now valid.
"invalid/inline-table/trailing-comma",
"invalid/inline-table/linebreak-1",
"invalid/inline-table/linebreak-2",
"invalid/inline-table/linebreak-3",
"invalid/inline-table/linebreak-4",
},
},

Expand All @@ -18,6 +23,7 @@ var versions = map[string]versionSpec{
"valid/string/escape-esc", // \e
"valid/string/hex-escape", "invalid/string/bad-hex-esc", // \x..
"valid/datetime/no-seconds", // Times without seconds
"valid/inline-table/newline",
},
},

Expand Down

0 comments on commit 6087694

Please sign in to comment.