-
-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inline tables with dotted keys inside inline arrays (#400)
For example this: arr = [ {a.b.c = 1}, ] Would lose the a.b context, and it would just be map["c" = 1].
- Loading branch information
Showing
9 changed files
with
164 additions
and
30 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
internal/toml-test/tests/valid/inline-table/inline-table.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name = { first = "Tom", last = "Preston-Werner" } | ||
point = { x = 1, y = 2 } | ||
simple = { a = 1 } | ||
str-key = { "a" = 1 } | ||
name = { first = "Tom", last = "Preston-Werner" } | ||
point = { x = 1, y = 2 } | ||
simple = { a = 1 } | ||
str-key = { "a" = 1 } | ||
table-array = [{ "a" = 1 }, { "b" = 2 }] |
66 changes: 66 additions & 0 deletions
66
internal/toml-test/tests/valid/inline-table/key-dotted-5.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"arr-1": [ | ||
{ | ||
"a": { | ||
"b": { | ||
"type": "integer", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
], | ||
"arr-2": [ | ||
{ | ||
"type": "string", | ||
"value": "str" | ||
}, | ||
{ | ||
"a": { | ||
"b": { | ||
"type": "integer", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
], | ||
"arr-3": [ | ||
{ | ||
"a": { | ||
"b": { | ||
"type": "integer", | ||
"value": "1" | ||
} | ||
} | ||
}, | ||
{ | ||
"a": { | ||
"b": { | ||
"type": "integer", | ||
"value": "2" | ||
} | ||
} | ||
} | ||
], | ||
"arr-4": [ | ||
{ | ||
"type": "string", | ||
"value": "str" | ||
}, | ||
{ | ||
"a": { | ||
"b": { | ||
"type": "integer", | ||
"value": "1" | ||
} | ||
} | ||
}, | ||
{ | ||
"a": { | ||
"b": { | ||
"type": "integer", | ||
"value": "2" | ||
} | ||
} | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
internal/toml-test/tests/valid/inline-table/key-dotted-5.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
arr-1 = [{a.b = 1}] | ||
arr-2 = ["str", {a.b = 1}] | ||
|
||
arr-3 = [{a.b = 1}, {a.b = 2}] | ||
arr-4 = ["str", {a.b = 1}, {a.b = 2}] |
28 changes: 28 additions & 0 deletions
28
internal/toml-test/tests/valid/inline-table/key-dotted-6.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"top": { | ||
"dot": { | ||
"dot": [ | ||
{ | ||
"dot": { | ||
"dot": { | ||
"dot": { | ||
"type": "integer", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"dot": { | ||
"dot": { | ||
"dot": { | ||
"type": "integer", | ||
"value": "2" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
internal/toml-test/tests/valid/inline-table/key-dotted-6.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
top.dot.dot = [ | ||
{dot.dot.dot = 1}, | ||
{dot.dot.dot = 2}, | ||
] |
18 changes: 18 additions & 0 deletions
18
internal/toml-test/tests/valid/inline-table/key-dotted-7.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"arr": [ | ||
{ | ||
"a": { | ||
"b": [ | ||
{ | ||
"c": { | ||
"d": { | ||
"type": "integer", | ||
"value": "1" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
internal/toml-test/tests/valid/inline-table/key-dotted-7.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
arr = [ | ||
{a.b = [{c.d = 1}]} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters