From cbd7fb6f5a1f35f43a63ce9a9485de0da1675738 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Thu, 7 Dec 2023 08:44:26 +0000 Subject: [PATCH] Split out some larger test files --- tests/files-toml-1.0.0 | 22 ++- tests/files-toml-1.1.0 | 22 ++- tests/valid/inline-table/key-dotted-1.json | 42 ++++++ tests/valid/inline-table/key-dotted-1.toml | 5 + tests/valid/inline-table/key-dotted-2.json | 26 ++++ tests/valid/inline-table/key-dotted-2.toml | 1 + tests/valid/inline-table/key-dotted-3.json | 30 ++++ tests/valid/inline-table/key-dotted-3.toml | 5 + tests/valid/inline-table/key-dotted-4.json | 40 +++++ tests/valid/inline-table/key-dotted-4.toml | 7 + tests/valid/inline-table/key-dotted.json | 140 ------------------ tests/valid/inline-table/key-dotted.toml | 23 --- tests/valid/key/dotted-1.json | 24 +++ tests/valid/key/dotted-1.toml | 4 + tests/valid/key/dotted-2.json | 52 +++++++ .../valid/key/{dotted.toml => dotted-2.toml} | 20 --- tests/valid/key/dotted-3.json | 34 +++++ tests/valid/key/dotted-3.toml | 9 ++ tests/valid/key/dotted-4.json | 38 +++++ tests/valid/key/dotted-4.toml | 10 ++ tests/valid/key/dotted.json | 132 ----------------- tests/valid/string/escapes.json | 26 ++-- tests/valid/string/escapes.toml | 28 ++-- tests/valid/string/multiline-empty.json | 18 +++ tests/valid/string/multiline-empty.toml | 15 ++ tests/valid/string/multiline.json | 16 -- tests/valid/string/multiline.toml | 15 -- toml_test.go | 31 ++++ 28 files changed, 455 insertions(+), 380 deletions(-) create mode 100644 tests/valid/inline-table/key-dotted-1.json create mode 100644 tests/valid/inline-table/key-dotted-1.toml create mode 100644 tests/valid/inline-table/key-dotted-2.json create mode 100644 tests/valid/inline-table/key-dotted-2.toml create mode 100644 tests/valid/inline-table/key-dotted-3.json create mode 100644 tests/valid/inline-table/key-dotted-3.toml create mode 100644 tests/valid/inline-table/key-dotted-4.json create mode 100644 tests/valid/inline-table/key-dotted-4.toml delete mode 100644 tests/valid/inline-table/key-dotted.json delete mode 100644 tests/valid/inline-table/key-dotted.toml create mode 100644 tests/valid/key/dotted-1.json create mode 100644 tests/valid/key/dotted-1.toml create mode 100644 tests/valid/key/dotted-2.json rename tests/valid/key/{dotted.toml => dotted-2.toml} (60%) create mode 100644 tests/valid/key/dotted-3.json create mode 100644 tests/valid/key/dotted-3.toml create mode 100644 tests/valid/key/dotted-4.json create mode 100644 tests/valid/key/dotted-4.toml delete mode 100644 tests/valid/key/dotted.json create mode 100644 tests/valid/string/multiline-empty.json create mode 100644 tests/valid/string/multiline-empty.toml diff --git a/tests/files-toml-1.0.0 b/tests/files-toml-1.0.0 index 5923c22..1f493db 100644 --- a/tests/files-toml-1.0.0 +++ b/tests/files-toml-1.0.0 @@ -474,8 +474,14 @@ valid/inline-table/end-in-bool.json valid/inline-table/end-in-bool.toml valid/inline-table/inline-table.json valid/inline-table/inline-table.toml -valid/inline-table/key-dotted.json -valid/inline-table/key-dotted.toml +valid/inline-table/key-dotted-1.json +valid/inline-table/key-dotted-1.toml +valid/inline-table/key-dotted-2.json +valid/inline-table/key-dotted-2.toml +valid/inline-table/key-dotted-3.json +valid/inline-table/key-dotted-3.toml +valid/inline-table/key-dotted-4.json +valid/inline-table/key-dotted-4.toml valid/inline-table/multiline.json valid/inline-table/multiline.toml valid/inline-table/nest.json @@ -496,8 +502,14 @@ valid/key/alphanum.json valid/key/alphanum.toml valid/key/case-sensitive.json valid/key/case-sensitive.toml -valid/key/dotted.json -valid/key/dotted.toml +valid/key/dotted-1.json +valid/key/dotted-1.toml +valid/key/dotted-2.json +valid/key/dotted-2.toml +valid/key/dotted-3.json +valid/key/dotted-3.toml +valid/key/dotted-4.json +valid/key/dotted-4.toml valid/key/dotted-empty.json valid/key/dotted-empty.toml valid/key/empty-1.json @@ -646,6 +658,8 @@ valid/string/escapes.json valid/string/escapes.toml valid/string/multiline.json valid/string/multiline.toml +valid/string/multiline-empty.json +valid/string/multiline-empty.toml valid/string/multiline-escaped-crlf.json valid/string/multiline-escaped-crlf.toml valid/string/multiline-quotes.json diff --git a/tests/files-toml-1.1.0 b/tests/files-toml-1.1.0 index 06f0f41..e09d106 100644 --- a/tests/files-toml-1.1.0 +++ b/tests/files-toml-1.1.0 @@ -466,8 +466,14 @@ valid/inline-table/end-in-bool.json valid/inline-table/end-in-bool.toml valid/inline-table/inline-table.json valid/inline-table/inline-table.toml -valid/inline-table/key-dotted.json -valid/inline-table/key-dotted.toml +valid/inline-table/key-dotted-1.json +valid/inline-table/key-dotted-1.toml +valid/inline-table/key-dotted-2.json +valid/inline-table/key-dotted-2.toml +valid/inline-table/key-dotted-3.json +valid/inline-table/key-dotted-3.toml +valid/inline-table/key-dotted-4.json +valid/inline-table/key-dotted-4.toml valid/inline-table/multiline.json valid/inline-table/multiline.toml valid/inline-table/nest.json @@ -490,8 +496,14 @@ valid/key/alphanum.json valid/key/alphanum.toml valid/key/case-sensitive.json valid/key/case-sensitive.toml -valid/key/dotted.json -valid/key/dotted.toml +valid/key/dotted-1.json +valid/key/dotted-1.toml +valid/key/dotted-2.json +valid/key/dotted-2.toml +valid/key/dotted-3.json +valid/key/dotted-3.toml +valid/key/dotted-4.json +valid/key/dotted-4.toml valid/key/dotted-empty.json valid/key/dotted-empty.toml valid/key/empty-1.json @@ -646,6 +658,8 @@ valid/string/hex-escape.json valid/string/hex-escape.toml valid/string/multiline.json valid/string/multiline.toml +valid/string/multiline-empty.json +valid/string/multiline-empty.toml valid/string/multiline-escaped-crlf.json valid/string/multiline-escaped-crlf.toml valid/string/multiline-quotes.json diff --git a/tests/valid/inline-table/key-dotted-1.json b/tests/valid/inline-table/key-dotted-1.json new file mode 100644 index 0000000..c7af0fa --- /dev/null +++ b/tests/valid/inline-table/key-dotted-1.json @@ -0,0 +1,42 @@ +{ + "a": { + "a": { + "b": { + "type": "integer", + "value": "1" + } + } + }, + "b": { + "a": { + "b": { + "type": "integer", + "value": "1" + } + } + }, + "c": { + "a": { + "b": { + "type": "integer", + "value": "1" + } + } + }, + "d": { + "a": { + "b": { + "type": "integer", + "value": "1" + } + } + }, + "e": { + "a": { + "b": { + "type": "integer", + "value": "1" + } + } + } +} diff --git a/tests/valid/inline-table/key-dotted-1.toml b/tests/valid/inline-table/key-dotted-1.toml new file mode 100644 index 0000000..e4fe1ac --- /dev/null +++ b/tests/valid/inline-table/key-dotted-1.toml @@ -0,0 +1,5 @@ +a = { a.b = 1 } +b = { "a"."b" = 1 } +c = { a . b = 1 } +d = { 'a' . "b" = 1 } +e = {a.b=1} diff --git a/tests/valid/inline-table/key-dotted-2.json b/tests/valid/inline-table/key-dotted-2.json new file mode 100644 index 0000000..6a3c6ed --- /dev/null +++ b/tests/valid/inline-table/key-dotted-2.json @@ -0,0 +1,26 @@ +{ + "many": { + "dots": { + "here": { + "dot": { + "dot": { + "dot": { + "a": { + "b": { + "c": { + "type": "integer", + "value": "1" + }, + "d": { + "type": "integer", + "value": "2" + } + } + } + } + } + } + } + } + } +} diff --git a/tests/valid/inline-table/key-dotted-2.toml b/tests/valid/inline-table/key-dotted-2.toml new file mode 100644 index 0000000..c248f4f --- /dev/null +++ b/tests/valid/inline-table/key-dotted-2.toml @@ -0,0 +1 @@ +many.dots.here.dot.dot.dot = {a.b.c = 1, a.b.d = 2} diff --git a/tests/valid/inline-table/key-dotted-3.json b/tests/valid/inline-table/key-dotted-3.json new file mode 100644 index 0000000..a989ab7 --- /dev/null +++ b/tests/valid/inline-table/key-dotted-3.json @@ -0,0 +1,30 @@ +{ + "tbl": { + "a": { + "b": { + "c": { + "d": { + "e": { + "type": "integer", + "value": "1" + } + } + } + } + }, + "x": { + "a": { + "b": { + "c": { + "d": { + "e": { + "type": "integer", + "value": "1" + } + } + } + } + } + } + } +} diff --git a/tests/valid/inline-table/key-dotted-3.toml b/tests/valid/inline-table/key-dotted-3.toml new file mode 100644 index 0000000..1b21ae4 --- /dev/null +++ b/tests/valid/inline-table/key-dotted-3.toml @@ -0,0 +1,5 @@ +[tbl] +a.b.c = {d.e=1} + +[tbl.x] +a.b.c = {d.e=1} diff --git a/tests/valid/inline-table/key-dotted-4.json b/tests/valid/inline-table/key-dotted-4.json new file mode 100644 index 0000000..07e5628 --- /dev/null +++ b/tests/valid/inline-table/key-dotted-4.json @@ -0,0 +1,40 @@ +{ + "arr": [ + { + "T": { + "a": { + "b": { + "type": "integer", + "value": "1" + } + } + }, + "t": { + "a": { + "b": { + "type": "integer", + "value": "1" + } + } + } + }, + { + "T": { + "a": { + "b": { + "type": "integer", + "value": "2" + } + } + }, + "t": { + "a": { + "b": { + "type": "integer", + "value": "2" + } + } + } + } + ] +} diff --git a/tests/valid/inline-table/key-dotted-4.toml b/tests/valid/inline-table/key-dotted-4.toml new file mode 100644 index 0000000..93d511d --- /dev/null +++ b/tests/valid/inline-table/key-dotted-4.toml @@ -0,0 +1,7 @@ +[[arr]] +t = {a.b=1} +T = {a.b=1} + +[[arr]] +t = {a.b=2} +T = {a.b=2} diff --git a/tests/valid/inline-table/key-dotted.json b/tests/valid/inline-table/key-dotted.json deleted file mode 100644 index 3886803..0000000 --- a/tests/valid/inline-table/key-dotted.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "a": { - "a": { - "b": { - "type": "integer", - "value": "1" - } - } - }, - "arr": [ - { - "T": { - "a": { - "b": { - "type": "integer", - "value": "1" - } - } - }, - "t": { - "a": { - "b": { - "type": "integer", - "value": "1" - } - } - } - }, - { - "T": { - "a": { - "b": { - "type": "integer", - "value": "2" - } - } - }, - "t": { - "a": { - "b": { - "type": "integer", - "value": "2" - } - } - } - } - ], - "b": { - "a": { - "b": { - "type": "integer", - "value": "1" - } - } - }, - "c": { - "a": { - "b": { - "type": "integer", - "value": "1" - } - } - }, - "d": { - "a": { - "b": { - "type": "integer", - "value": "1" - } - } - }, - "e": { - "a": { - "b": { - "type": "integer", - "value": "1" - } - } - }, - "inline": { - "a": { - "b": { - "type": "integer", - "value": "42" - } - } - }, - "many": { - "dots": { - "here": { - "dot": { - "dot": { - "dot": { - "a": { - "b": { - "c": { - "type": "integer", - "value": "1" - }, - "d": { - "type": "integer", - "value": "2" - } - } - } - } - } - } - } - } - }, - "tbl": { - "a": { - "b": { - "c": { - "d": { - "e": { - "type": "integer", - "value": "1" - } - } - } - } - }, - "x": { - "a": { - "b": { - "c": { - "d": { - "e": { - "type": "integer", - "value": "1" - } - } - } - } - } - } - } -} diff --git a/tests/valid/inline-table/key-dotted.toml b/tests/valid/inline-table/key-dotted.toml deleted file mode 100644 index e812943..0000000 --- a/tests/valid/inline-table/key-dotted.toml +++ /dev/null @@ -1,23 +0,0 @@ -inline = {a.b = 42} - -many.dots.here.dot.dot.dot = {a.b.c = 1, a.b.d = 2} - -a = { a.b = 1 } -b = { "a"."b" = 1 } -c = { a . b = 1 } -d = { 'a' . "b" = 1 } -e = {a.b=1} - -[tbl] -a.b.c = {d.e=1} - -[tbl.x] -a.b.c = {d.e=1} - -[[arr]] -t = {a.b=1} -T = {a.b=1} - -[[arr]] -t = {a.b=2} -T = {a.b=2} diff --git a/tests/valid/key/dotted-1.json b/tests/valid/key/dotted-1.json new file mode 100644 index 0000000..d5720fd --- /dev/null +++ b/tests/valid/key/dotted-1.json @@ -0,0 +1,24 @@ +{ + "many": { + "dots": { + "dot": { + "dot": { + "dot": { + "type": "integer", + "value": "42" + } + } + } + } + }, + "name": { + "first": { + "type": "string", + "value": "Arthur" + }, + "last": { + "type": "string", + "value": "Dent" + } + } +} diff --git a/tests/valid/key/dotted-1.toml b/tests/valid/key/dotted-1.toml new file mode 100644 index 0000000..47567f8 --- /dev/null +++ b/tests/valid/key/dotted-1.toml @@ -0,0 +1,4 @@ +name.first = "Arthur" +"name".'last' = "Dent" + +many.dots.dot.dot.dot = 42 diff --git a/tests/valid/key/dotted-2.json b/tests/valid/key/dotted-2.json new file mode 100644 index 0000000..aa6bdba --- /dev/null +++ b/tests/valid/key/dotted-2.json @@ -0,0 +1,52 @@ +{ + "count": { + "a": { + "type": "integer", + "value": "1" + }, + "b": { + "type": "integer", + "value": "2" + }, + "c": { + "type": "integer", + "value": "3" + }, + "d": { + "type": "integer", + "value": "4" + }, + "e": { + "type": "integer", + "value": "5" + }, + "f": { + "type": "integer", + "value": "6" + }, + "g": { + "type": "integer", + "value": "7" + }, + "h": { + "type": "integer", + "value": "8" + }, + "i": { + "type": "integer", + "value": "9" + }, + "j": { + "type": "integer", + "value": "10" + }, + "k": { + "type": "integer", + "value": "11" + }, + "l": { + "type": "integer", + "value": "12" + } + } +} diff --git a/tests/valid/key/dotted.toml b/tests/valid/key/dotted-2.toml similarity index 60% rename from tests/valid/key/dotted.toml rename to tests/valid/key/dotted-2.toml index 52d62d7..1bdf17a 100644 --- a/tests/valid/key/dotted.toml +++ b/tests/valid/key/dotted-2.toml @@ -1,10 +1,5 @@ # Note: this file contains literal tab characters. -name.first = "Arthur" -"name".'last' = "Dent" - -many.dots.here.dot.dot.dot = 42 - # Space are ignored, and key parts can be quoted. count.a = 1 count . b = 2 @@ -18,18 +13,3 @@ count.'i' = 9 count . 'j' = 10 "count".k = 11 "count" . l = 12 - -[tbl] -a.b.c = 42.666 - -[a.few.dots] -polka.dot = "again?" -polka.dance-with = "Dot" - -[[arr]] -a.b.c=1 -a.b.d=2 - -[[arr]] -a.b.c=3 -a.b.d=4 diff --git a/tests/valid/key/dotted-3.json b/tests/valid/key/dotted-3.json new file mode 100644 index 0000000..1c0ac09 --- /dev/null +++ b/tests/valid/key/dotted-3.json @@ -0,0 +1,34 @@ +{ + "a": { + "few": { + "dots": { + "polka": { + "dance-with": { + "type": "string", + "value": "Dot" + }, + "dot": { + "type": "string", + "value": "again?" + } + } + } + } + }, + "tbl": { + "a": { + "b": { + "c": { + "type": "float", + "value": "42.666" + } + } + } + }, + "top": { + "key": { + "type": "integer", + "value": "1" + } + } +} diff --git a/tests/valid/key/dotted-3.toml b/tests/valid/key/dotted-3.toml new file mode 100644 index 0000000..5286626 --- /dev/null +++ b/tests/valid/key/dotted-3.toml @@ -0,0 +1,9 @@ +top.key = 1 + +[tbl] +a.b.c = 42.666 + +[a.few.dots] +polka.dot = "again?" +polka.dance-with = "Dot" + diff --git a/tests/valid/key/dotted-4.json b/tests/valid/key/dotted-4.json new file mode 100644 index 0000000..ca997b2 --- /dev/null +++ b/tests/valid/key/dotted-4.json @@ -0,0 +1,38 @@ +{ + "arr": [ + { + "a": { + "b": { + "c": { + "type": "integer", + "value": "1" + }, + "d": { + "type": "integer", + "value": "2" + } + } + } + }, + { + "a": { + "b": { + "c": { + "type": "integer", + "value": "3" + }, + "d": { + "type": "integer", + "value": "4" + } + } + } + } + ], + "top": { + "key": { + "type": "integer", + "value": "1" + } + } +} diff --git a/tests/valid/key/dotted-4.toml b/tests/valid/key/dotted-4.toml new file mode 100644 index 0000000..ecf581c --- /dev/null +++ b/tests/valid/key/dotted-4.toml @@ -0,0 +1,10 @@ +top.key = 1 + +[[arr]] +a.b.c=1 +a.b.d=2 + +[[arr]] +a.b.c=3 +a.b.d=4 + diff --git a/tests/valid/key/dotted.json b/tests/valid/key/dotted.json deleted file mode 100644 index a527a72..0000000 --- a/tests/valid/key/dotted.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "a": { - "few": { - "dots": { - "polka": { - "dance-with": { - "type": "string", - "value": "Dot" - }, - "dot": { - "type": "string", - "value": "again?" - } - } - } - } - }, - "arr": [ - { - "a": { - "b": { - "c": { - "type": "integer", - "value": "1" - }, - "d": { - "type": "integer", - "value": "2" - } - } - } - }, - { - "a": { - "b": { - "c": { - "type": "integer", - "value": "3" - }, - "d": { - "type": "integer", - "value": "4" - } - } - } - } - ], - "count": { - "a": { - "type": "integer", - "value": "1" - }, - "b": { - "type": "integer", - "value": "2" - }, - "c": { - "type": "integer", - "value": "3" - }, - "d": { - "type": "integer", - "value": "4" - }, - "e": { - "type": "integer", - "value": "5" - }, - "f": { - "type": "integer", - "value": "6" - }, - "g": { - "type": "integer", - "value": "7" - }, - "h": { - "type": "integer", - "value": "8" - }, - "i": { - "type": "integer", - "value": "9" - }, - "j": { - "type": "integer", - "value": "10" - }, - "k": { - "type": "integer", - "value": "11" - }, - "l": { - "type": "integer", - "value": "12" - } - }, - "many": { - "dots": { - "here": { - "dot": { - "dot": { - "dot": { - "type": "integer", - "value": "42" - } - } - } - } - } - }, - "name": { - "first": { - "type": "string", - "value": "Arthur" - }, - "last": { - "type": "string", - "value": "Dent" - } - }, - "tbl": { - "a": { - "b": { - "c": { - "type": "float", - "value": "42.666" - } - } - } - } -} diff --git a/tests/valid/string/escapes.json b/tests/valid/string/escapes.json index d849574..0a74122 100644 --- a/tests/valid/string/escapes.json +++ b/tests/valid/string/escapes.json @@ -1,54 +1,54 @@ { "backslash": { "type": "string", - "value": "This string has a \\ backslash character." + "value": "|\\." }, "backspace": { "type": "string", - "value": "This string has a \u0008 backspace character." + "value": "|\u0008." }, "carriage": { "type": "string", - "value": "This string has a \r carriage return character." + "value": "|\r." }, "delete": { "type": "string", - "value": "This string has a  delete control code." + "value": "|." }, "formfeed": { "type": "string", - "value": "This string has a \u000c form feed character." + "value": "|\u000c." }, "newline": { "type": "string", - "value": "This string has a \n new line character." + "value": "|\n." }, "notunicode1": { "type": "string", - "value": "This string does not have a unicode \\u escape." + "value": "|\\u." }, "notunicode2": { "type": "string", - "value": "This string does not have a unicode \\u escape." + "value": "|\\u." }, "notunicode3": { "type": "string", - "value": "This string does not have a unicode \\u0075 escape." + "value": "|\\u0075." }, "notunicode4": { "type": "string", - "value": "This string does not have a unicode \\u escape." + "value": "|\\u." }, "quote": { "type": "string", - "value": "This string has a \" quote character." + "value": "|\"." }, "tab": { "type": "string", - "value": "This string has a \t tab character." + "value": "|\t." }, "unitseparator": { "type": "string", - "value": "This string has a \u001f unit separator control code." + "value": "|\u001f." } } diff --git a/tests/valid/string/escapes.toml b/tests/valid/string/escapes.toml index 78f7ebd..5146065 100644 --- a/tests/valid/string/escapes.toml +++ b/tests/valid/string/escapes.toml @@ -1,13 +1,15 @@ -backspace = "This string has a \b backspace character." -tab = "This string has a \t tab character." -newline = "This string has a \n new line character." -formfeed = "This string has a \f form feed character." -carriage = "This string has a \r carriage return character." -quote = "This string has a \" quote character." -backslash = "This string has a \\ backslash character." -notunicode1 = "This string does not have a unicode \\u escape." -notunicode2 = "This string does not have a unicode \u005Cu escape." -notunicode3 = "This string does not have a unicode \\u0075 escape." -notunicode4 = "This string does not have a unicode \\\u0075 escape." -delete = "This string has a \u007F delete control code." -unitseparator = "This string has a \u001F unit separator control code." +backspace = "|\b." +tab = "|\t." +newline = "|\n." +formfeed = "|\f." +carriage = "|\r." +quote = "|\"." +backslash = "|\\." +delete = "|\u007F." +unitseparator = "|\u001F." + +# \u is escaped, so should NOT be interperted as a \u escape. +notunicode1 = "|\\u." +notunicode2 = "|\u005Cu." +notunicode3 = "|\\u0075." +notunicode4 = "|\\\u0075." diff --git a/tests/valid/string/multiline-empty.json b/tests/valid/string/multiline-empty.json new file mode 100644 index 0000000..f89f6ad --- /dev/null +++ b/tests/valid/string/multiline-empty.json @@ -0,0 +1,18 @@ +{ + "empty-1": { + "type": "string", + "value": "" + }, + "empty-2": { + "type": "string", + "value": "" + }, + "empty-3": { + "type": "string", + "value": "" + }, + "empty-4": { + "type": "string", + "value": "" + } +} diff --git a/tests/valid/string/multiline-empty.toml b/tests/valid/string/multiline-empty.toml new file mode 100644 index 0000000..66f29a3 --- /dev/null +++ b/tests/valid/string/multiline-empty.toml @@ -0,0 +1,15 @@ +empty-1 = """""" + +# A newline immediately following the opening delimiter will be trimmed. +empty-2 = """ +""" + +# \ at the end of line trims newlines as well; note that last \ is followed by +# two spaces, which are ignored. +empty-3 = """\ + """ +empty-4 = """\ + \ + \ + """ + diff --git a/tests/valid/string/multiline.json b/tests/valid/string/multiline.json index 66e572b..1c89b12 100644 --- a/tests/valid/string/multiline.json +++ b/tests/valid/string/multiline.json @@ -27,22 +27,6 @@ "type": "string", "value": "a \tb" }, - "multiline_empty_four": { - "type": "string", - "value": "" - }, - "multiline_empty_one": { - "type": "string", - "value": "" - }, - "multiline_empty_three": { - "type": "string", - "value": "" - }, - "multiline_empty_two": { - "type": "string", - "value": "" - }, "no-space": { "type": "string", "value": "ab" diff --git a/tests/valid/string/multiline.toml b/tests/valid/string/multiline.toml index f3b3c2e..c38187d 100644 --- a/tests/valid/string/multiline.toml +++ b/tests/valid/string/multiline.toml @@ -1,20 +1,5 @@ # NOTE: this file includes some literal tab characters. -multiline_empty_one = """""" - -# A newline immediately following the opening delimiter will be trimmed. -multiline_empty_two = """ -""" - -# \ at the end of line trims newlines as well; note that last \ is followed by -# two spaces, which are ignored. -multiline_empty_three = """\ - """ -multiline_empty_four = """\ - \ - \ - """ - equivalent_one = "The quick brown fox jumps over the lazy dog." equivalent_two = """ The quick brown \ diff --git a/toml_test.go b/toml_test.go index 4050abe..9aa6fa8 100644 --- a/toml_test.go +++ b/toml_test.go @@ -1,6 +1,7 @@ package tomltest import ( + "io/fs" "os" "strings" "testing" @@ -116,3 +117,33 @@ func TestCompareTOML(t *testing.T) { }) } } + +func TestSize(t *testing.T) { + err := fs.WalkDir(EmbeddedTests(), "valid", func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + + inf, err := d.Info() + if err != nil { + return err + } + if inf.IsDir() { + return nil + } + if strings.Contains(path, "/spec-") || strings.Contains(path, "/spec/") { + return nil + } + if path == "valid/comment/tricky.json" { // Exception + return nil + } + + if inf.Size() > 1024 { + t.Errorf("larger than 1K: %s (%fK)", path, float64(inf.Size())/1024) + } + return nil + }) + if err != nil { + t.Fatal(err) + } +}