Skip to content

Commit

Permalink
Add tests from go-toml
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Oct 13, 2023
1 parent bb159a8 commit f03077a
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 3 deletions.
26 changes: 26 additions & 0 deletions tests/valid/datetime/edge.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"first-date": {
"type": "date-local",
"value": "0000-01-01"
},
"first-local": {
"type": "datetime-local",
"value": "0000-01-01T00:00:00"
},
"first-offset": {
"type": "datetime",
"value": "0000-01-01T00:00:00Z"
},
"last-date": {
"type": "date-local",
"value": "9999-12-31"
},
"last-local": {
"type": "datetime-local",
"value": "9999-12-31T23:59:59"
},
"last-offset": {
"type": "datetime",
"value": "9999-12-31T23:59:59Z"
}
}
7 changes: 7 additions & 0 deletions tests/valid/datetime/edge.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
first-offset = 0000-01-01 00:00:00Z
first-local = 0000-01-01 00:00:00
first-date = 0000-01-01

last-offset = 9999-12-31 23:59:59Z
last-local = 9999-12-31 23:59:59
last-date = 9999-12-31
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions tests/valid/key/empty-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"": {
"type": "string",
"value": "blank"
}
}
1 change: 1 addition & 0 deletions tests/valid/key/empty-2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'' = "blank"
6 changes: 6 additions & 0 deletions tests/valid/key/empty-3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"": {
"type": "integer",
"value": "0"
}
}
1 change: 1 addition & 0 deletions tests/valid/key/empty-3.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
''=0
4 changes: 4 additions & 0 deletions tests/valid/key/escapes.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"\u0008": {
"type": "string",
"value": "bell"
},
"\n": {
"type": "string",
"value": "newline"
Expand Down
1 change: 1 addition & 0 deletions tests/valid/key/escapes.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"\n" = "newline"
"\b" = "bell"
"\u00c0" = "latin capital letter A with grave"
"\"" = "just a quote"

Expand Down
6 changes: 6 additions & 0 deletions tests/valid/key/zero.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"0": {
"type": "integer",
"value": "0"
}
}
1 change: 1 addition & 0 deletions tests/valid/key/zero.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0=0
36 changes: 36 additions & 0 deletions tests/valid/string/unicode-escape.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,41 @@
"delta-2": {
"type": "string",
"value": "δ"
},
"ml-a": {
"type": "string",
"value": "a"
},
"ml-b": {
"type": "string",
"value": "b"
},
"ml-c": {
"type": "string",
"value": "c"
},
"ml-delta-1": {
"type": "string",
"value": "δ"
},
"ml-delta-2": {
"type": "string",
"value": "δ"
},
"ml-null-1": {
"type": "string",
"value": "\u0000"
},
"ml-null-2": {
"type": "string",
"value": "\u0000"
},
"null-1": {
"type": "string",
"value": "\u0000"
},
"null-2": {
"type": "string",
"value": "\u0000"
}
}
16 changes: 13 additions & 3 deletions tests/valid/string/unicode-escape.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
delta-1 = "\u03B4"
delta-2 = "\U000003B4"
a = "\u0061"
b = "\u0062"
c = "\U00000063"
a = "\u0061"
b = "\u0062"
c = "\U00000063"
null-1 = "\u0000"
null-2 = "\U00000000"

ml-delta-1 = """\u03B4"""
ml-delta-2 = """\U000003B4"""
ml-a = """\u0061"""
ml-b = """\u0062"""
ml-c = """\U00000063"""
ml-null-1 = """\u0000"""
ml-null-2 = """\U00000000"""

0 comments on commit f03077a

Please sign in to comment.