aboutsummaryrefslogtreecommitdiff
path: root/test-suite/tests/invalid
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2017-11-12 17:26:09 -0800
committerDavid Tolnay <dtolnay@gmail.com>2017-11-12 19:33:11 -0800
commit3ad6e71f53a87215fb5286bcf87de15524699561 (patch)
treef9ac5154af7984a7c65b903869487c11baee3596 /test-suite/tests/invalid
parent3b77b5fb6520c7bf13be6308978efa8a185d0c12 (diff)
downloadmilf-rs-3ad6e71f53a87215fb5286bcf87de15524699561.tar.gz
milf-rs-3ad6e71f53a87215fb5286bcf87de15524699561.zip
Move tests into their own crate
Diffstat (limited to 'test-suite/tests/invalid')
-rw-r--r--test-suite/tests/invalid/array-mixed-types-arrays-and-ints.toml1
-rw-r--r--test-suite/tests/invalid/array-mixed-types-ints-and-floats.toml1
-rw-r--r--test-suite/tests/invalid/array-mixed-types-strings-and-ints.toml1
-rw-r--r--test-suite/tests/invalid/datetime-malformed-no-leads.toml1
-rw-r--r--test-suite/tests/invalid/datetime-malformed-no-secs.toml1
-rw-r--r--test-suite/tests/invalid/datetime-malformed-no-t.toml1
-rw-r--r--test-suite/tests/invalid/datetime-malformed-with-milli.toml1
-rw-r--r--test-suite/tests/invalid/duplicate-key-table.toml5
-rw-r--r--test-suite/tests/invalid/duplicate-keys.toml2
-rw-r--r--test-suite/tests/invalid/duplicate-tables.toml2
-rw-r--r--test-suite/tests/invalid/empty-implicit-table.toml1
-rw-r--r--test-suite/tests/invalid/empty-table.toml1
-rw-r--r--test-suite/tests/invalid/float-no-leading-zero.toml2
-rw-r--r--test-suite/tests/invalid/float-no-trailing-digits.toml2
-rw-r--r--test-suite/tests/invalid/key-after-array.toml1
-rw-r--r--test-suite/tests/invalid/key-after-table.toml1
-rw-r--r--test-suite/tests/invalid/key-empty.toml1
-rw-r--r--test-suite/tests/invalid/key-hash.toml1
-rw-r--r--test-suite/tests/invalid/key-newline.toml2
-rw-r--r--test-suite/tests/invalid/key-open-bracket.toml1
-rw-r--r--test-suite/tests/invalid/key-single-open-bracket.toml1
-rw-r--r--test-suite/tests/invalid/key-space.toml1
-rw-r--r--test-suite/tests/invalid/key-start-bracket.toml3
-rw-r--r--test-suite/tests/invalid/key-two-equals.toml1
-rw-r--r--test-suite/tests/invalid/string-bad-byte-escape.toml1
-rw-r--r--test-suite/tests/invalid/string-bad-escape.toml1
-rw-r--r--test-suite/tests/invalid/string-byte-escapes.toml1
-rw-r--r--test-suite/tests/invalid/string-no-close.toml1
-rw-r--r--test-suite/tests/invalid/table-array-implicit.toml14
-rw-r--r--test-suite/tests/invalid/table-array-malformed-bracket.toml2
-rw-r--r--test-suite/tests/invalid/table-array-malformed-empty.toml2
-rw-r--r--test-suite/tests/invalid/table-empty.toml1
-rw-r--r--test-suite/tests/invalid/table-nested-brackets-close.toml2
-rw-r--r--test-suite/tests/invalid/table-nested-brackets-open.toml2
-rw-r--r--test-suite/tests/invalid/table-whitespace.toml1
-rw-r--r--test-suite/tests/invalid/table-with-pound.toml2
-rw-r--r--test-suite/tests/invalid/text-after-array-entries.toml4
-rw-r--r--test-suite/tests/invalid/text-after-integer.toml1
-rw-r--r--test-suite/tests/invalid/text-after-string.toml1
-rw-r--r--test-suite/tests/invalid/text-after-table.toml1
-rw-r--r--test-suite/tests/invalid/text-before-array-separator.toml4
-rw-r--r--test-suite/tests/invalid/text-in-array.toml5
42 files changed, 81 insertions, 0 deletions
diff --git a/test-suite/tests/invalid/array-mixed-types-arrays-and-ints.toml b/test-suite/tests/invalid/array-mixed-types-arrays-and-ints.toml
new file mode 100644
index 0000000..051ec73
--- /dev/null
+++ b/test-suite/tests/invalid/array-mixed-types-arrays-and-ints.toml
@@ -0,0 +1 @@
+arrays-and-ints = [1, ["Arrays are not integers."]]
diff --git a/test-suite/tests/invalid/array-mixed-types-ints-and-floats.toml b/test-suite/tests/invalid/array-mixed-types-ints-and-floats.toml
new file mode 100644
index 0000000..a5aa9b7
--- /dev/null
+++ b/test-suite/tests/invalid/array-mixed-types-ints-and-floats.toml
@@ -0,0 +1 @@
+ints-and-floats = [1, 1.1]
diff --git a/test-suite/tests/invalid/array-mixed-types-strings-and-ints.toml b/test-suite/tests/invalid/array-mixed-types-strings-and-ints.toml
new file mode 100644
index 0000000..f348308
--- /dev/null
+++ b/test-suite/tests/invalid/array-mixed-types-strings-and-ints.toml
@@ -0,0 +1 @@
+strings-and-ints = ["hi", 42]
diff --git a/test-suite/tests/invalid/datetime-malformed-no-leads.toml b/test-suite/tests/invalid/datetime-malformed-no-leads.toml
new file mode 100644
index 0000000..123f173
--- /dev/null
+++ b/test-suite/tests/invalid/datetime-malformed-no-leads.toml
@@ -0,0 +1 @@
+no-leads = 1987-7-05T17:45:00Z
diff --git a/test-suite/tests/invalid/datetime-malformed-no-secs.toml b/test-suite/tests/invalid/datetime-malformed-no-secs.toml
new file mode 100644
index 0000000..ba93900
--- /dev/null
+++ b/test-suite/tests/invalid/datetime-malformed-no-secs.toml
@@ -0,0 +1 @@
+no-secs = 1987-07-05T17:45Z
diff --git a/test-suite/tests/invalid/datetime-malformed-no-t.toml b/test-suite/tests/invalid/datetime-malformed-no-t.toml
new file mode 100644
index 0000000..617e3c5
--- /dev/null
+++ b/test-suite/tests/invalid/datetime-malformed-no-t.toml
@@ -0,0 +1 @@
+no-t = 1987-07-0517:45:00Z
diff --git a/test-suite/tests/invalid/datetime-malformed-with-milli.toml b/test-suite/tests/invalid/datetime-malformed-with-milli.toml
new file mode 100644
index 0000000..eef792f
--- /dev/null
+++ b/test-suite/tests/invalid/datetime-malformed-with-milli.toml
@@ -0,0 +1 @@
+with-milli = 1987-07-5T17:45:00.12Z
diff --git a/test-suite/tests/invalid/duplicate-key-table.toml b/test-suite/tests/invalid/duplicate-key-table.toml
new file mode 100644
index 0000000..cedf05f
--- /dev/null
+++ b/test-suite/tests/invalid/duplicate-key-table.toml
@@ -0,0 +1,5 @@
+[fruit]
+type = "apple"
+
+[fruit.type]
+apple = "yes"
diff --git a/test-suite/tests/invalid/duplicate-keys.toml b/test-suite/tests/invalid/duplicate-keys.toml
new file mode 100644
index 0000000..9b5aee0
--- /dev/null
+++ b/test-suite/tests/invalid/duplicate-keys.toml
@@ -0,0 +1,2 @@
+dupe = false
+dupe = true
diff --git a/test-suite/tests/invalid/duplicate-tables.toml b/test-suite/tests/invalid/duplicate-tables.toml
new file mode 100644
index 0000000..8ddf49b
--- /dev/null
+++ b/test-suite/tests/invalid/duplicate-tables.toml
@@ -0,0 +1,2 @@
+[a]
+[a]
diff --git a/test-suite/tests/invalid/empty-implicit-table.toml b/test-suite/tests/invalid/empty-implicit-table.toml
new file mode 100644
index 0000000..0cc36d0
--- /dev/null
+++ b/test-suite/tests/invalid/empty-implicit-table.toml
@@ -0,0 +1 @@
+[naughty..naughty]
diff --git a/test-suite/tests/invalid/empty-table.toml b/test-suite/tests/invalid/empty-table.toml
new file mode 100644
index 0000000..fe51488
--- /dev/null
+++ b/test-suite/tests/invalid/empty-table.toml
@@ -0,0 +1 @@
+[]
diff --git a/test-suite/tests/invalid/float-no-leading-zero.toml b/test-suite/tests/invalid/float-no-leading-zero.toml
new file mode 100644
index 0000000..cab76bf
--- /dev/null
+++ b/test-suite/tests/invalid/float-no-leading-zero.toml
@@ -0,0 +1,2 @@
+answer = .12345
+neganswer = -.12345
diff --git a/test-suite/tests/invalid/float-no-trailing-digits.toml b/test-suite/tests/invalid/float-no-trailing-digits.toml
new file mode 100644
index 0000000..cbff2d0
--- /dev/null
+++ b/test-suite/tests/invalid/float-no-trailing-digits.toml
@@ -0,0 +1,2 @@
+answer = 1.
+neganswer = -1.
diff --git a/test-suite/tests/invalid/key-after-array.toml b/test-suite/tests/invalid/key-after-array.toml
new file mode 100644
index 0000000..5c1a1b0
--- /dev/null
+++ b/test-suite/tests/invalid/key-after-array.toml
@@ -0,0 +1 @@
+[[agencies]] owner = "S Cjelli"
diff --git a/test-suite/tests/invalid/key-after-table.toml b/test-suite/tests/invalid/key-after-table.toml
new file mode 100644
index 0000000..4bc8213
--- /dev/null
+++ b/test-suite/tests/invalid/key-after-table.toml
@@ -0,0 +1 @@
+[history] guard = "sleeping"
diff --git a/test-suite/tests/invalid/key-empty.toml b/test-suite/tests/invalid/key-empty.toml
new file mode 100644
index 0000000..09f998f
--- /dev/null
+++ b/test-suite/tests/invalid/key-empty.toml
@@ -0,0 +1 @@
+ = 1
diff --git a/test-suite/tests/invalid/key-hash.toml b/test-suite/tests/invalid/key-hash.toml
new file mode 100644
index 0000000..e321b1f
--- /dev/null
+++ b/test-suite/tests/invalid/key-hash.toml
@@ -0,0 +1 @@
+a# = 1
diff --git a/test-suite/tests/invalid/key-newline.toml b/test-suite/tests/invalid/key-newline.toml
new file mode 100644
index 0000000..707aad5
--- /dev/null
+++ b/test-suite/tests/invalid/key-newline.toml
@@ -0,0 +1,2 @@
+a
+= 1
diff --git a/test-suite/tests/invalid/key-open-bracket.toml b/test-suite/tests/invalid/key-open-bracket.toml
new file mode 100644
index 0000000..f0aeb16
--- /dev/null
+++ b/test-suite/tests/invalid/key-open-bracket.toml
@@ -0,0 +1 @@
+[abc = 1
diff --git a/test-suite/tests/invalid/key-single-open-bracket.toml b/test-suite/tests/invalid/key-single-open-bracket.toml
new file mode 100644
index 0000000..8e2f0be
--- /dev/null
+++ b/test-suite/tests/invalid/key-single-open-bracket.toml
@@ -0,0 +1 @@
+[ \ No newline at end of file
diff --git a/test-suite/tests/invalid/key-space.toml b/test-suite/tests/invalid/key-space.toml
new file mode 100644
index 0000000..201806d
--- /dev/null
+++ b/test-suite/tests/invalid/key-space.toml
@@ -0,0 +1 @@
+a b = 1 \ No newline at end of file
diff --git a/test-suite/tests/invalid/key-start-bracket.toml b/test-suite/tests/invalid/key-start-bracket.toml
new file mode 100644
index 0000000..e0597ae
--- /dev/null
+++ b/test-suite/tests/invalid/key-start-bracket.toml
@@ -0,0 +1,3 @@
+[a]
+[xyz = 5
+[b]
diff --git a/test-suite/tests/invalid/key-two-equals.toml b/test-suite/tests/invalid/key-two-equals.toml
new file mode 100644
index 0000000..25a0378
--- /dev/null
+++ b/test-suite/tests/invalid/key-two-equals.toml
@@ -0,0 +1 @@
+key= = 1
diff --git a/test-suite/tests/invalid/string-bad-byte-escape.toml b/test-suite/tests/invalid/string-bad-byte-escape.toml
new file mode 100644
index 0000000..4c7be59
--- /dev/null
+++ b/test-suite/tests/invalid/string-bad-byte-escape.toml
@@ -0,0 +1 @@
+naughty = "\xAg"
diff --git a/test-suite/tests/invalid/string-bad-escape.toml b/test-suite/tests/invalid/string-bad-escape.toml
new file mode 100644
index 0000000..60acb0c
--- /dev/null
+++ b/test-suite/tests/invalid/string-bad-escape.toml
@@ -0,0 +1 @@
+invalid-escape = "This string has a bad \a escape character."
diff --git a/test-suite/tests/invalid/string-byte-escapes.toml b/test-suite/tests/invalid/string-byte-escapes.toml
new file mode 100644
index 0000000..e94452a
--- /dev/null
+++ b/test-suite/tests/invalid/string-byte-escapes.toml
@@ -0,0 +1 @@
+answer = "\x33"
diff --git a/test-suite/tests/invalid/string-no-close.toml b/test-suite/tests/invalid/string-no-close.toml
new file mode 100644
index 0000000..0c292fc
--- /dev/null
+++ b/test-suite/tests/invalid/string-no-close.toml
@@ -0,0 +1 @@
+no-ending-quote = "One time, at band camp
diff --git a/test-suite/tests/invalid/table-array-implicit.toml b/test-suite/tests/invalid/table-array-implicit.toml
new file mode 100644
index 0000000..05f2507
--- /dev/null
+++ b/test-suite/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/test-suite/tests/invalid/table-array-malformed-bracket.toml b/test-suite/tests/invalid/table-array-malformed-bracket.toml
new file mode 100644
index 0000000..39c73b0
--- /dev/null
+++ b/test-suite/tests/invalid/table-array-malformed-bracket.toml
@@ -0,0 +1,2 @@
+[[albums]
+name = "Born to Run"
diff --git a/test-suite/tests/invalid/table-array-malformed-empty.toml b/test-suite/tests/invalid/table-array-malformed-empty.toml
new file mode 100644
index 0000000..a470ca3
--- /dev/null
+++ b/test-suite/tests/invalid/table-array-malformed-empty.toml
@@ -0,0 +1,2 @@
+[[]]
+name = "Born to Run"
diff --git a/test-suite/tests/invalid/table-empty.toml b/test-suite/tests/invalid/table-empty.toml
new file mode 100644
index 0000000..fe51488
--- /dev/null
+++ b/test-suite/tests/invalid/table-empty.toml
@@ -0,0 +1 @@
+[]
diff --git a/test-suite/tests/invalid/table-nested-brackets-close.toml b/test-suite/tests/invalid/table-nested-brackets-close.toml
new file mode 100644
index 0000000..c8b5a67
--- /dev/null
+++ b/test-suite/tests/invalid/table-nested-brackets-close.toml
@@ -0,0 +1,2 @@
+[a]b]
+zyx = 42
diff --git a/test-suite/tests/invalid/table-nested-brackets-open.toml b/test-suite/tests/invalid/table-nested-brackets-open.toml
new file mode 100644
index 0000000..246d7e9
--- /dev/null
+++ b/test-suite/tests/invalid/table-nested-brackets-open.toml
@@ -0,0 +1,2 @@
+[a[b]
+zyx = 42
diff --git a/test-suite/tests/invalid/table-whitespace.toml b/test-suite/tests/invalid/table-whitespace.toml
new file mode 100644
index 0000000..79bbcb1
--- /dev/null
+++ b/test-suite/tests/invalid/table-whitespace.toml
@@ -0,0 +1 @@
+[invalid key] \ No newline at end of file
diff --git a/test-suite/tests/invalid/table-with-pound.toml b/test-suite/tests/invalid/table-with-pound.toml
new file mode 100644
index 0000000..0d8edb5
--- /dev/null
+++ b/test-suite/tests/invalid/table-with-pound.toml
@@ -0,0 +1,2 @@
+[key#group]
+answer = 42 \ No newline at end of file
diff --git a/test-suite/tests/invalid/text-after-array-entries.toml b/test-suite/tests/invalid/text-after-array-entries.toml
new file mode 100644
index 0000000..1a72890
--- /dev/null
+++ b/test-suite/tests/invalid/text-after-array-entries.toml
@@ -0,0 +1,4 @@
+array = [
+ "Is there life after an array separator?", No
+ "Entry"
+]
diff --git a/test-suite/tests/invalid/text-after-integer.toml b/test-suite/tests/invalid/text-after-integer.toml
new file mode 100644
index 0000000..42de7af
--- /dev/null
+++ b/test-suite/tests/invalid/text-after-integer.toml
@@ -0,0 +1 @@
+answer = 42 the ultimate answer?
diff --git a/test-suite/tests/invalid/text-after-string.toml b/test-suite/tests/invalid/text-after-string.toml
new file mode 100644
index 0000000..c92a6f1
--- /dev/null
+++ b/test-suite/tests/invalid/text-after-string.toml
@@ -0,0 +1 @@
+string = "Is there life after strings?" No.
diff --git a/test-suite/tests/invalid/text-after-table.toml b/test-suite/tests/invalid/text-after-table.toml
new file mode 100644
index 0000000..87da9db
--- /dev/null
+++ b/test-suite/tests/invalid/text-after-table.toml
@@ -0,0 +1 @@
+[error] this shouldn't be here
diff --git a/test-suite/tests/invalid/text-before-array-separator.toml b/test-suite/tests/invalid/text-before-array-separator.toml
new file mode 100644
index 0000000..9b06a39
--- /dev/null
+++ b/test-suite/tests/invalid/text-before-array-separator.toml
@@ -0,0 +1,4 @@
+array = [
+ "Is there life before an array separator?" No,
+ "Entry"
+]
diff --git a/test-suite/tests/invalid/text-in-array.toml b/test-suite/tests/invalid/text-in-array.toml
new file mode 100644
index 0000000..a6a6c42
--- /dev/null
+++ b/test-suite/tests/invalid/text-in-array.toml
@@ -0,0 +1,5 @@
+array = [
+ "Entry 1",
+ I don't belong,
+ "Entry 2",
+]