From 0d8ce979a4d98c895f5f75826e8c49f02a64f311 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 15 Jan 2015 12:44:05 -0800 Subject: Move tests to integration tests --- tests/invalid/array-mixed-types-arrays-and-ints.toml | 1 + tests/invalid/array-mixed-types-ints-and-floats.toml | 1 + tests/invalid/array-mixed-types-strings-and-ints.toml | 1 + tests/invalid/datetime-malformed-no-leads.toml | 1 + tests/invalid/datetime-malformed-no-secs.toml | 1 + tests/invalid/datetime-malformed-no-t.toml | 1 + tests/invalid/datetime-malformed-no-z.toml | 1 + tests/invalid/datetime-malformed-with-milli.toml | 1 + tests/invalid/duplicate-key-table.toml | 5 +++++ tests/invalid/duplicate-keys.toml | 2 ++ tests/invalid/duplicate-tables.toml | 2 ++ tests/invalid/empty-implicit-table.toml | 1 + tests/invalid/empty-table.toml | 1 + tests/invalid/float-no-leading-zero.toml | 2 ++ tests/invalid/float-no-trailing-digits.toml | 2 ++ tests/invalid/key-two-equals.toml | 1 + tests/invalid/string-bad-byte-escape.toml | 1 + tests/invalid/string-bad-escape.toml | 1 + tests/invalid/string-byte-escapes.toml | 1 + tests/invalid/string-no-close.toml | 1 + tests/invalid/table-array-implicit.toml | 14 ++++++++++++++ tests/invalid/table-array-malformed-bracket.toml | 2 ++ tests/invalid/table-array-malformed-empty.toml | 2 ++ tests/invalid/table-nested-brackets-close.toml | 2 ++ tests/invalid/table-nested-brackets-open.toml | 2 ++ tests/invalid/text-after-array-entries.toml | 4 ++++ tests/invalid/text-after-integer.toml | 1 + tests/invalid/text-after-string.toml | 1 + tests/invalid/text-after-table.toml | 1 + tests/invalid/text-before-array-separator.toml | 4 ++++ tests/invalid/text-in-array.toml | 5 +++++ 31 files changed, 66 insertions(+) create mode 100644 tests/invalid/array-mixed-types-arrays-and-ints.toml create mode 100644 tests/invalid/array-mixed-types-ints-and-floats.toml create mode 100644 tests/invalid/array-mixed-types-strings-and-ints.toml create mode 100644 tests/invalid/datetime-malformed-no-leads.toml create mode 100644 tests/invalid/datetime-malformed-no-secs.toml create mode 100644 tests/invalid/datetime-malformed-no-t.toml create mode 100644 tests/invalid/datetime-malformed-no-z.toml create mode 100644 tests/invalid/datetime-malformed-with-milli.toml create mode 100644 tests/invalid/duplicate-key-table.toml create mode 100644 tests/invalid/duplicate-keys.toml create mode 100644 tests/invalid/duplicate-tables.toml create mode 100644 tests/invalid/empty-implicit-table.toml create mode 100644 tests/invalid/empty-table.toml create mode 100644 tests/invalid/float-no-leading-zero.toml create mode 100644 tests/invalid/float-no-trailing-digits.toml create mode 100644 tests/invalid/key-two-equals.toml create mode 100644 tests/invalid/string-bad-byte-escape.toml create mode 100644 tests/invalid/string-bad-escape.toml create mode 100644 tests/invalid/string-byte-escapes.toml create mode 100644 tests/invalid/string-no-close.toml create mode 100644 tests/invalid/table-array-implicit.toml create mode 100644 tests/invalid/table-array-malformed-bracket.toml create mode 100644 tests/invalid/table-array-malformed-empty.toml create mode 100644 tests/invalid/table-nested-brackets-close.toml create mode 100644 tests/invalid/table-nested-brackets-open.toml create mode 100644 tests/invalid/text-after-array-entries.toml create mode 100644 tests/invalid/text-after-integer.toml create mode 100644 tests/invalid/text-after-string.toml create mode 100644 tests/invalid/text-after-table.toml create mode 100644 tests/invalid/text-before-array-separator.toml create mode 100644 tests/invalid/text-in-array.toml (limited to 'tests/invalid') diff --git a/tests/invalid/array-mixed-types-arrays-and-ints.toml b/tests/invalid/array-mixed-types-arrays-and-ints.toml new file mode 100644 index 0000000..051ec73 --- /dev/null +++ b/tests/invalid/array-mixed-types-arrays-and-ints.toml @@ -0,0 +1 @@ +arrays-and-ints = [1, ["Arrays are not integers."]] diff --git a/tests/invalid/array-mixed-types-ints-and-floats.toml b/tests/invalid/array-mixed-types-ints-and-floats.toml new file mode 100644 index 0000000..51ebe80 --- /dev/null +++ b/tests/invalid/array-mixed-types-ints-and-floats.toml @@ -0,0 +1 @@ +ints-and-floats = [1, 1.0] diff --git a/tests/invalid/array-mixed-types-strings-and-ints.toml b/tests/invalid/array-mixed-types-strings-and-ints.toml new file mode 100644 index 0000000..f348308 --- /dev/null +++ b/tests/invalid/array-mixed-types-strings-and-ints.toml @@ -0,0 +1 @@ +strings-and-ints = ["hi", 42] diff --git a/tests/invalid/datetime-malformed-no-leads.toml b/tests/invalid/datetime-malformed-no-leads.toml new file mode 100644 index 0000000..123f173 --- /dev/null +++ b/tests/invalid/datetime-malformed-no-leads.toml @@ -0,0 +1 @@ +no-leads = 1987-7-05T17:45:00Z diff --git a/tests/invalid/datetime-malformed-no-secs.toml b/tests/invalid/datetime-malformed-no-secs.toml new file mode 100644 index 0000000..ba93900 --- /dev/null +++ b/tests/invalid/datetime-malformed-no-secs.toml @@ -0,0 +1 @@ +no-secs = 1987-07-05T17:45Z diff --git a/tests/invalid/datetime-malformed-no-t.toml b/tests/invalid/datetime-malformed-no-t.toml new file mode 100644 index 0000000..617e3c5 --- /dev/null +++ b/tests/invalid/datetime-malformed-no-t.toml @@ -0,0 +1 @@ +no-t = 1987-07-0517:45:00Z diff --git a/tests/invalid/datetime-malformed-no-z.toml b/tests/invalid/datetime-malformed-no-z.toml new file mode 100644 index 0000000..cf66b1e --- /dev/null +++ b/tests/invalid/datetime-malformed-no-z.toml @@ -0,0 +1 @@ +no-z = 1987-07-05T17:45:00 diff --git a/tests/invalid/datetime-malformed-with-milli.toml b/tests/invalid/datetime-malformed-with-milli.toml new file mode 100644 index 0000000..eef792f --- /dev/null +++ b/tests/invalid/datetime-malformed-with-milli.toml @@ -0,0 +1 @@ +with-milli = 1987-07-5T17:45:00.12Z diff --git a/tests/invalid/duplicate-key-table.toml b/tests/invalid/duplicate-key-table.toml new file mode 100644 index 0000000..cedf05f --- /dev/null +++ b/tests/invalid/duplicate-key-table.toml @@ -0,0 +1,5 @@ +[fruit] +type = "apple" + +[fruit.type] +apple = "yes" diff --git a/tests/invalid/duplicate-keys.toml b/tests/invalid/duplicate-keys.toml new file mode 100644 index 0000000..9b5aee0 --- /dev/null +++ b/tests/invalid/duplicate-keys.toml @@ -0,0 +1,2 @@ +dupe = false +dupe = true diff --git a/tests/invalid/duplicate-tables.toml b/tests/invalid/duplicate-tables.toml new file mode 100644 index 0000000..8ddf49b --- /dev/null +++ b/tests/invalid/duplicate-tables.toml @@ -0,0 +1,2 @@ +[a] +[a] diff --git a/tests/invalid/empty-implicit-table.toml b/tests/invalid/empty-implicit-table.toml new file mode 100644 index 0000000..0cc36d0 --- /dev/null +++ b/tests/invalid/empty-implicit-table.toml @@ -0,0 +1 @@ +[naughty..naughty] diff --git a/tests/invalid/empty-table.toml b/tests/invalid/empty-table.toml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/tests/invalid/empty-table.toml @@ -0,0 +1 @@ +[] diff --git a/tests/invalid/float-no-leading-zero.toml b/tests/invalid/float-no-leading-zero.toml new file mode 100644 index 0000000..cab76bf --- /dev/null +++ b/tests/invalid/float-no-leading-zero.toml @@ -0,0 +1,2 @@ +answer = .12345 +neganswer = -.12345 diff --git a/tests/invalid/float-no-trailing-digits.toml b/tests/invalid/float-no-trailing-digits.toml new file mode 100644 index 0000000..cbff2d0 --- /dev/null +++ b/tests/invalid/float-no-trailing-digits.toml @@ -0,0 +1,2 @@ +answer = 1. +neganswer = -1. diff --git a/tests/invalid/key-two-equals.toml b/tests/invalid/key-two-equals.toml new file mode 100644 index 0000000..25a0378 --- /dev/null +++ b/tests/invalid/key-two-equals.toml @@ -0,0 +1 @@ +key= = 1 diff --git a/tests/invalid/string-bad-byte-escape.toml b/tests/invalid/string-bad-byte-escape.toml new file mode 100644 index 0000000..4c7be59 --- /dev/null +++ b/tests/invalid/string-bad-byte-escape.toml @@ -0,0 +1 @@ +naughty = "\xAg" diff --git a/tests/invalid/string-bad-escape.toml b/tests/invalid/string-bad-escape.toml new file mode 100644 index 0000000..60acb0c --- /dev/null +++ b/tests/invalid/string-bad-escape.toml @@ -0,0 +1 @@ +invalid-escape = "This string has a bad \a escape character." diff --git a/tests/invalid/string-byte-escapes.toml b/tests/invalid/string-byte-escapes.toml new file mode 100644 index 0000000..e94452a --- /dev/null +++ b/tests/invalid/string-byte-escapes.toml @@ -0,0 +1 @@ +answer = "\x33" diff --git a/tests/invalid/string-no-close.toml b/tests/invalid/string-no-close.toml new file mode 100644 index 0000000..0c292fc --- /dev/null +++ b/tests/invalid/string-no-close.toml @@ -0,0 +1 @@ +no-ending-quote = "One time, at band camp diff --git a/tests/invalid/table-array-implicit.toml b/tests/invalid/table-array-implicit.toml new file mode 100644 index 0000000..05f2507 --- /dev/null +++ b/tests/invalid/table-array-implicit.toml @@ -0,0 +1,14 @@ +# This test is a bit tricky. It should fail because the first use of +# `[[albums.songs]]` without first declaring `albums` implies that `albums` +# must be a table. The alternative would be quite weird. Namely, it wouldn't +# comply with the TOML spec: "Each double-bracketed sub-table will belong to +# the most *recently* defined table element *above* it." +# +# This is in contrast to the *valid* test, table-array-implicit where +# `[[albums.songs]]` works by itself, so long as `[[albums]]` isn't declared +# later. (Although, `[albums]` could be.) +[[albums.songs]] +name = "Glory Days" + +[[albums]] +name = "Born in the USA" diff --git a/tests/invalid/table-array-malformed-bracket.toml b/tests/invalid/table-array-malformed-bracket.toml new file mode 100644 index 0000000..39c73b0 --- /dev/null +++ b/tests/invalid/table-array-malformed-bracket.toml @@ -0,0 +1,2 @@ +[[albums] +name = "Born to Run" diff --git a/tests/invalid/table-array-malformed-empty.toml b/tests/invalid/table-array-malformed-empty.toml new file mode 100644 index 0000000..a470ca3 --- /dev/null +++ b/tests/invalid/table-array-malformed-empty.toml @@ -0,0 +1,2 @@ +[[]] +name = "Born to Run" diff --git a/tests/invalid/table-nested-brackets-close.toml b/tests/invalid/table-nested-brackets-close.toml new file mode 100644 index 0000000..c8b5a67 --- /dev/null +++ b/tests/invalid/table-nested-brackets-close.toml @@ -0,0 +1,2 @@ +[a]b] +zyx = 42 diff --git a/tests/invalid/table-nested-brackets-open.toml b/tests/invalid/table-nested-brackets-open.toml new file mode 100644 index 0000000..246d7e9 --- /dev/null +++ b/tests/invalid/table-nested-brackets-open.toml @@ -0,0 +1,2 @@ +[a[b] +zyx = 42 diff --git a/tests/invalid/text-after-array-entries.toml b/tests/invalid/text-after-array-entries.toml new file mode 100644 index 0000000..1a72890 --- /dev/null +++ b/tests/invalid/text-after-array-entries.toml @@ -0,0 +1,4 @@ +array = [ + "Is there life after an array separator?", No + "Entry" +] diff --git a/tests/invalid/text-after-integer.toml b/tests/invalid/text-after-integer.toml new file mode 100644 index 0000000..42de7af --- /dev/null +++ b/tests/invalid/text-after-integer.toml @@ -0,0 +1 @@ +answer = 42 the ultimate answer? diff --git a/tests/invalid/text-after-string.toml b/tests/invalid/text-after-string.toml new file mode 100644 index 0000000..c92a6f1 --- /dev/null +++ b/tests/invalid/text-after-string.toml @@ -0,0 +1 @@ +string = "Is there life after strings?" No. diff --git a/tests/invalid/text-after-table.toml b/tests/invalid/text-after-table.toml new file mode 100644 index 0000000..87da9db --- /dev/null +++ b/tests/invalid/text-after-table.toml @@ -0,0 +1 @@ +[error] this shouldn't be here diff --git a/tests/invalid/text-before-array-separator.toml b/tests/invalid/text-before-array-separator.toml new file mode 100644 index 0000000..9b06a39 --- /dev/null +++ b/tests/invalid/text-before-array-separator.toml @@ -0,0 +1,4 @@ +array = [ + "Is there life before an array separator?" No, + "Entry" +] diff --git a/tests/invalid/text-in-array.toml b/tests/invalid/text-in-array.toml new file mode 100644 index 0000000..a6a6c42 --- /dev/null +++ b/tests/invalid/text-in-array.toml @@ -0,0 +1,5 @@ +array = [ + "Entry 1", + I don't belong, + "Entry 2", +] -- cgit v1.2.3