From 7bbbfd046324363c8db1fb15d39aeb02fe7331b5 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 21 Mar 2021 14:10:24 -0600 Subject: hilarious and original joke --- Cargo.toml | 17 +- README.md | 22 +- examples/decode.rs | 8 +- examples/enum_external.rs | 6 +- examples/toml2json.rs | 26 +-- src/datetime.rs | 16 +- src/de.rs | 38 ++-- src/lib.rs | 34 +-- src/macros.rs | 166 +++++++-------- src/map.rs | 16 +- src/ser.rs | 38 ++-- src/spanned.rs | 14 +- src/value.rs | 44 ++-- test-suite/Cargo.toml | 4 +- test-suite/benches/linear.rs | 2 +- test-suite/tests/backcompat.rs | 14 +- test-suite/tests/datetime.rs | 14 +- test-suite/tests/de-errors.rs | 12 +- test-suite/tests/display-tricky.rs | 12 +- test-suite/tests/display.rs | 6 +- test-suite/tests/float.rs | 10 +- test-suite/tests/formatting.rs | 4 +- test-suite/tests/invalid-misc.rs | 6 +- test-suite/tests/invalid.rs | 94 ++++---- .../tests/invalid/datetime-malformed-no-leads.milf | 1 + .../tests/invalid/datetime-malformed-no-leads.toml | 1 - .../tests/invalid/datetime-malformed-no-secs.milf | 1 + .../tests/invalid/datetime-malformed-no-secs.toml | 1 - .../tests/invalid/datetime-malformed-no-t.milf | 1 + .../tests/invalid/datetime-malformed-no-t.toml | 1 - .../invalid/datetime-malformed-with-milli.milf | 1 + .../invalid/datetime-malformed-with-milli.toml | 1 - test-suite/tests/invalid/duplicate-key-table.milf | 5 + test-suite/tests/invalid/duplicate-key-table.toml | 5 - test-suite/tests/invalid/duplicate-keys.milf | 2 + test-suite/tests/invalid/duplicate-keys.toml | 2 - test-suite/tests/invalid/duplicate-table.milf | 8 + test-suite/tests/invalid/duplicate-table.toml | 8 - test-suite/tests/invalid/duplicate-tables.milf | 2 + test-suite/tests/invalid/duplicate-tables.toml | 2 - test-suite/tests/invalid/empty-implicit-table.milf | 1 + test-suite/tests/invalid/empty-implicit-table.toml | 1 - test-suite/tests/invalid/empty-table.milf | 1 + test-suite/tests/invalid/empty-table.toml | 1 - .../tests/invalid/float-no-leading-zero.milf | 2 + .../tests/invalid/float-no-leading-zero.toml | 2 - test-suite/tests/invalid/float-no-suffix.milf | 1 + test-suite/tests/invalid/float-no-suffix.toml | 1 - .../tests/invalid/float-no-trailing-digits.milf | 2 + .../tests/invalid/float-no-trailing-digits.toml | 2 - test-suite/tests/invalid/key-after-array.milf | 1 + test-suite/tests/invalid/key-after-array.toml | 1 - test-suite/tests/invalid/key-after-table.milf | 1 + test-suite/tests/invalid/key-after-table.toml | 1 - test-suite/tests/invalid/key-empty.milf | 1 + test-suite/tests/invalid/key-empty.toml | 1 - test-suite/tests/invalid/key-hash.milf | 1 + test-suite/tests/invalid/key-hash.toml | 1 - test-suite/tests/invalid/key-newline.milf | 2 + test-suite/tests/invalid/key-newline.toml | 2 - test-suite/tests/invalid/key-open-bracket.milf | 1 + test-suite/tests/invalid/key-open-bracket.toml | 1 - .../tests/invalid/key-single-open-bracket.milf | 1 + .../tests/invalid/key-single-open-bracket.toml | 1 - test-suite/tests/invalid/key-space.milf | 1 + test-suite/tests/invalid/key-space.toml | 1 - test-suite/tests/invalid/key-start-bracket.milf | 3 + test-suite/tests/invalid/key-start-bracket.toml | 3 - test-suite/tests/invalid/key-two-equals.milf | 1 + test-suite/tests/invalid/key-two-equals.toml | 1 - .../tests/invalid/string-bad-byte-escape.milf | 1 + .../tests/invalid/string-bad-byte-escape.toml | 1 - test-suite/tests/invalid/string-bad-escape.milf | 1 + test-suite/tests/invalid/string-bad-escape.toml | 1 - .../invalid/string-bad-line-ending-escape.milf | 3 + .../invalid/string-bad-line-ending-escape.toml | 3 - test-suite/tests/invalid/string-byte-escapes.milf | 1 + test-suite/tests/invalid/string-byte-escapes.toml | 1 - test-suite/tests/invalid/string-no-close.milf | 1 + test-suite/tests/invalid/string-no-close.toml | 1 - test-suite/tests/invalid/table-array-implicit.milf | 14 ++ test-suite/tests/invalid/table-array-implicit.toml | 14 -- .../invalid/table-array-malformed-bracket.milf | 2 + .../invalid/table-array-malformed-bracket.toml | 2 - .../tests/invalid/table-array-malformed-empty.milf | 2 + .../tests/invalid/table-array-malformed-empty.toml | 2 - test-suite/tests/invalid/table-empty.milf | 1 + test-suite/tests/invalid/table-empty.toml | 1 - .../tests/invalid/table-nested-brackets-close.milf | 2 + .../tests/invalid/table-nested-brackets-close.toml | 2 - .../tests/invalid/table-nested-brackets-open.milf | 2 + .../tests/invalid/table-nested-brackets-open.toml | 2 - test-suite/tests/invalid/table-whitespace.milf | 1 + test-suite/tests/invalid/table-whitespace.toml | 1 - test-suite/tests/invalid/table-with-pound.milf | 2 + test-suite/tests/invalid/table-with-pound.toml | 2 - .../tests/invalid/text-after-array-entries.milf | 4 + .../tests/invalid/text-after-array-entries.toml | 4 - test-suite/tests/invalid/text-after-integer.milf | 1 + test-suite/tests/invalid/text-after-integer.toml | 1 - test-suite/tests/invalid/text-after-string.milf | 1 + test-suite/tests/invalid/text-after-string.toml | 1 - test-suite/tests/invalid/text-after-table.milf | 1 + test-suite/tests/invalid/text-after-table.toml | 1 - .../tests/invalid/text-before-array-separator.milf | 4 + .../tests/invalid/text-before-array-separator.toml | 4 - test-suite/tests/invalid/text-in-array.milf | 5 + test-suite/tests/invalid/text-in-array.toml | 5 - test-suite/tests/macros.rs | 38 ++-- test-suite/tests/parser.rs | 22 +- test-suite/tests/pretty.rs | 104 ++++----- test-suite/tests/serde.rs | 64 +++--- test-suite/tests/spanned-impls.rs | 2 +- test-suite/tests/spanned.rs | 22 +- test-suite/tests/tables-last.rs | 6 +- test-suite/tests/valid.rs | 196 ++++++++--------- test-suite/tests/valid/array-empty.milf | 1 + test-suite/tests/valid/array-empty.toml | 1 - .../valid/array-mixed-types-arrays-and-ints.milf | 1 + .../valid/array-mixed-types-arrays-and-ints.toml | 1 - .../valid/array-mixed-types-ints-and-floats.milf | 1 + .../valid/array-mixed-types-ints-and-floats.toml | 1 - .../valid/array-mixed-types-strings-and-ints.milf | 1 + .../valid/array-mixed-types-strings-and-ints.toml | 1 - test-suite/tests/valid/array-nospaces.milf | 1 + test-suite/tests/valid/array-nospaces.toml | 1 - test-suite/tests/valid/arrays-hetergeneous.milf | 1 + test-suite/tests/valid/arrays-hetergeneous.toml | 1 - test-suite/tests/valid/arrays-nested.milf | 1 + test-suite/tests/valid/arrays-nested.toml | 1 - test-suite/tests/valid/arrays.milf | 8 + test-suite/tests/valid/arrays.toml | 8 - test-suite/tests/valid/bool.milf | 2 + test-suite/tests/valid/bool.toml | 2 - test-suite/tests/valid/comments-everywhere.milf | 24 +++ test-suite/tests/valid/comments-everywhere.toml | 24 --- test-suite/tests/valid/datetime-truncate.milf | 1 + test-suite/tests/valid/datetime-truncate.toml | 1 - test-suite/tests/valid/datetime.milf | 1 + test-suite/tests/valid/datetime.toml | 1 - test-suite/tests/valid/dotted-keys.milf | 7 + test-suite/tests/valid/dotted-keys.toml | 7 - test-suite/tests/valid/empty.milf | 0 test-suite/tests/valid/empty.toml | 0 test-suite/tests/valid/example-bom.milf | 5 + test-suite/tests/valid/example-bom.toml | 5 - test-suite/tests/valid/example-v0.3.0.milf | 182 ++++++++++++++++ test-suite/tests/valid/example-v0.3.0.toml | 182 ---------------- test-suite/tests/valid/example-v0.4.0.milf | 236 +++++++++++++++++++++ test-suite/tests/valid/example-v0.4.0.toml | 236 --------------------- test-suite/tests/valid/example.milf | 5 + test-suite/tests/valid/example.toml | 5 - test-suite/tests/valid/example2.json | 2 +- test-suite/tests/valid/example2.milf | 47 ++++ test-suite/tests/valid/example2.toml | 47 ---- test-suite/tests/valid/float-exponent.milf | 9 + test-suite/tests/valid/float-exponent.toml | 9 - test-suite/tests/valid/float.milf | 2 + test-suite/tests/valid/float.toml | 2 - test-suite/tests/valid/hard_example.milf | 33 +++ test-suite/tests/valid/hard_example.toml | 33 --- .../tests/valid/implicit-and-explicit-after.milf | 5 + .../tests/valid/implicit-and-explicit-after.toml | 5 - .../tests/valid/implicit-and-explicit-before.milf | 5 + .../tests/valid/implicit-and-explicit-before.toml | 5 - test-suite/tests/valid/implicit-groups.milf | 2 + test-suite/tests/valid/implicit-groups.toml | 2 - test-suite/tests/valid/integer.milf | 18 ++ test-suite/tests/valid/integer.toml | 18 -- test-suite/tests/valid/key-equals-nospace.milf | 1 + test-suite/tests/valid/key-equals-nospace.toml | 1 - test-suite/tests/valid/key-quote-newline.milf | 1 + test-suite/tests/valid/key-quote-newline.toml | 1 - test-suite/tests/valid/key-space.milf | 1 + test-suite/tests/valid/key-space.toml | 1 - test-suite/tests/valid/key-special-chars.milf | 1 + test-suite/tests/valid/key-special-chars.toml | 1 - test-suite/tests/valid/key-with-pound.milf | 1 + test-suite/tests/valid/key-with-pound.toml | 1 - test-suite/tests/valid/long-float.milf | 2 + test-suite/tests/valid/long-float.toml | 2 - test-suite/tests/valid/long-integer.milf | 2 + test-suite/tests/valid/long-integer.toml | 2 - test-suite/tests/valid/multiline-string.milf | 34 +++ test-suite/tests/valid/multiline-string.toml | 34 --- test-suite/tests/valid/quote-surrounded-value.milf | 2 + test-suite/tests/valid/quote-surrounded-value.toml | 2 - test-suite/tests/valid/raw-multiline-string.milf | 9 + test-suite/tests/valid/raw-multiline-string.toml | 9 - test-suite/tests/valid/raw-string.milf | 7 + test-suite/tests/valid/raw-string.toml | 7 - test-suite/tests/valid/string-delim-end.milf | 3 + test-suite/tests/valid/string-delim-end.toml | 3 - test-suite/tests/valid/string-empty.milf | 1 + test-suite/tests/valid/string-empty.toml | 1 - test-suite/tests/valid/string-escapes.milf | 14 ++ test-suite/tests/valid/string-escapes.toml | 14 -- test-suite/tests/valid/string-simple.milf | 1 + test-suite/tests/valid/string-simple.toml | 1 - test-suite/tests/valid/string-with-pound.milf | 2 + test-suite/tests/valid/string-with-pound.toml | 2 - test-suite/tests/valid/table-array-implicit.milf | 2 + test-suite/tests/valid/table-array-implicit.toml | 2 - test-suite/tests/valid/table-array-many.milf | 11 + test-suite/tests/valid/table-array-many.toml | 11 - .../tests/valid/table-array-nest-no-keys.milf | 6 + .../tests/valid/table-array-nest-no-keys.toml | 6 - test-suite/tests/valid/table-array-nest.milf | 17 ++ test-suite/tests/valid/table-array-nest.toml | 17 -- test-suite/tests/valid/table-array-one.milf | 3 + test-suite/tests/valid/table-array-one.toml | 3 - test-suite/tests/valid/table-empty.milf | 1 + test-suite/tests/valid/table-empty.toml | 1 - test-suite/tests/valid/table-multi-empty.milf | 5 + test-suite/tests/valid/table-multi-empty.toml | 5 - test-suite/tests/valid/table-sub-empty.milf | 2 + test-suite/tests/valid/table-sub-empty.toml | 2 - test-suite/tests/valid/table-whitespace.milf | 1 + test-suite/tests/valid/table-whitespace.toml | 1 - test-suite/tests/valid/table-with-pound.milf | 2 + test-suite/tests/valid/table-with-pound.toml | 2 - test-suite/tests/valid/unicode-escape.milf | 6 + test-suite/tests/valid/unicode-escape.toml | 6 - test-suite/tests/valid/unicode-literal.milf | 1 + test-suite/tests/valid/unicode-literal.toml | 1 - tests/enum_external_deserialize.rs | 48 ++--- 226 files changed, 1390 insertions(+), 1393 deletions(-) create mode 100644 test-suite/tests/invalid/datetime-malformed-no-leads.milf delete mode 100644 test-suite/tests/invalid/datetime-malformed-no-leads.toml create mode 100644 test-suite/tests/invalid/datetime-malformed-no-secs.milf delete mode 100644 test-suite/tests/invalid/datetime-malformed-no-secs.toml create mode 100644 test-suite/tests/invalid/datetime-malformed-no-t.milf delete mode 100644 test-suite/tests/invalid/datetime-malformed-no-t.toml create mode 100644 test-suite/tests/invalid/datetime-malformed-with-milli.milf delete mode 100644 test-suite/tests/invalid/datetime-malformed-with-milli.toml create mode 100644 test-suite/tests/invalid/duplicate-key-table.milf delete mode 100644 test-suite/tests/invalid/duplicate-key-table.toml create mode 100644 test-suite/tests/invalid/duplicate-keys.milf delete mode 100644 test-suite/tests/invalid/duplicate-keys.toml create mode 100644 test-suite/tests/invalid/duplicate-table.milf delete mode 100644 test-suite/tests/invalid/duplicate-table.toml create mode 100644 test-suite/tests/invalid/duplicate-tables.milf delete mode 100644 test-suite/tests/invalid/duplicate-tables.toml create mode 100644 test-suite/tests/invalid/empty-implicit-table.milf delete mode 100644 test-suite/tests/invalid/empty-implicit-table.toml create mode 100644 test-suite/tests/invalid/empty-table.milf delete mode 100644 test-suite/tests/invalid/empty-table.toml create mode 100644 test-suite/tests/invalid/float-no-leading-zero.milf delete mode 100644 test-suite/tests/invalid/float-no-leading-zero.toml create mode 100644 test-suite/tests/invalid/float-no-suffix.milf delete mode 100644 test-suite/tests/invalid/float-no-suffix.toml create mode 100644 test-suite/tests/invalid/float-no-trailing-digits.milf delete mode 100644 test-suite/tests/invalid/float-no-trailing-digits.toml create mode 100644 test-suite/tests/invalid/key-after-array.milf delete mode 100644 test-suite/tests/invalid/key-after-array.toml create mode 100644 test-suite/tests/invalid/key-after-table.milf delete mode 100644 test-suite/tests/invalid/key-after-table.toml create mode 100644 test-suite/tests/invalid/key-empty.milf delete mode 100644 test-suite/tests/invalid/key-empty.toml create mode 100644 test-suite/tests/invalid/key-hash.milf delete mode 100644 test-suite/tests/invalid/key-hash.toml create mode 100644 test-suite/tests/invalid/key-newline.milf delete mode 100644 test-suite/tests/invalid/key-newline.toml create mode 100644 test-suite/tests/invalid/key-open-bracket.milf delete mode 100644 test-suite/tests/invalid/key-open-bracket.toml create mode 100644 test-suite/tests/invalid/key-single-open-bracket.milf delete mode 100644 test-suite/tests/invalid/key-single-open-bracket.toml create mode 100644 test-suite/tests/invalid/key-space.milf delete mode 100644 test-suite/tests/invalid/key-space.toml create mode 100644 test-suite/tests/invalid/key-start-bracket.milf delete mode 100644 test-suite/tests/invalid/key-start-bracket.toml create mode 100644 test-suite/tests/invalid/key-two-equals.milf delete mode 100644 test-suite/tests/invalid/key-two-equals.toml create mode 100644 test-suite/tests/invalid/string-bad-byte-escape.milf delete mode 100644 test-suite/tests/invalid/string-bad-byte-escape.toml create mode 100644 test-suite/tests/invalid/string-bad-escape.milf delete mode 100644 test-suite/tests/invalid/string-bad-escape.toml create mode 100644 test-suite/tests/invalid/string-bad-line-ending-escape.milf delete mode 100644 test-suite/tests/invalid/string-bad-line-ending-escape.toml create mode 100644 test-suite/tests/invalid/string-byte-escapes.milf delete mode 100644 test-suite/tests/invalid/string-byte-escapes.toml create mode 100644 test-suite/tests/invalid/string-no-close.milf delete mode 100644 test-suite/tests/invalid/string-no-close.toml create mode 100644 test-suite/tests/invalid/table-array-implicit.milf delete mode 100644 test-suite/tests/invalid/table-array-implicit.toml create mode 100644 test-suite/tests/invalid/table-array-malformed-bracket.milf delete mode 100644 test-suite/tests/invalid/table-array-malformed-bracket.toml create mode 100644 test-suite/tests/invalid/table-array-malformed-empty.milf delete mode 100644 test-suite/tests/invalid/table-array-malformed-empty.toml create mode 100644 test-suite/tests/invalid/table-empty.milf delete mode 100644 test-suite/tests/invalid/table-empty.toml create mode 100644 test-suite/tests/invalid/table-nested-brackets-close.milf delete mode 100644 test-suite/tests/invalid/table-nested-brackets-close.toml create mode 100644 test-suite/tests/invalid/table-nested-brackets-open.milf delete mode 100644 test-suite/tests/invalid/table-nested-brackets-open.toml create mode 100644 test-suite/tests/invalid/table-whitespace.milf delete mode 100644 test-suite/tests/invalid/table-whitespace.toml create mode 100644 test-suite/tests/invalid/table-with-pound.milf delete mode 100644 test-suite/tests/invalid/table-with-pound.toml create mode 100644 test-suite/tests/invalid/text-after-array-entries.milf delete mode 100644 test-suite/tests/invalid/text-after-array-entries.toml create mode 100644 test-suite/tests/invalid/text-after-integer.milf delete mode 100644 test-suite/tests/invalid/text-after-integer.toml create mode 100644 test-suite/tests/invalid/text-after-string.milf delete mode 100644 test-suite/tests/invalid/text-after-string.toml create mode 100644 test-suite/tests/invalid/text-after-table.milf delete mode 100644 test-suite/tests/invalid/text-after-table.toml create mode 100644 test-suite/tests/invalid/text-before-array-separator.milf delete mode 100644 test-suite/tests/invalid/text-before-array-separator.toml create mode 100644 test-suite/tests/invalid/text-in-array.milf delete mode 100644 test-suite/tests/invalid/text-in-array.toml create mode 100644 test-suite/tests/valid/array-empty.milf delete mode 100644 test-suite/tests/valid/array-empty.toml create mode 100644 test-suite/tests/valid/array-mixed-types-arrays-and-ints.milf delete mode 100644 test-suite/tests/valid/array-mixed-types-arrays-and-ints.toml create mode 100644 test-suite/tests/valid/array-mixed-types-ints-and-floats.milf delete mode 100644 test-suite/tests/valid/array-mixed-types-ints-and-floats.toml create mode 100644 test-suite/tests/valid/array-mixed-types-strings-and-ints.milf delete mode 100644 test-suite/tests/valid/array-mixed-types-strings-and-ints.toml create mode 100644 test-suite/tests/valid/array-nospaces.milf delete mode 100644 test-suite/tests/valid/array-nospaces.toml create mode 100644 test-suite/tests/valid/arrays-hetergeneous.milf delete mode 100644 test-suite/tests/valid/arrays-hetergeneous.toml create mode 100644 test-suite/tests/valid/arrays-nested.milf delete mode 100644 test-suite/tests/valid/arrays-nested.toml create mode 100644 test-suite/tests/valid/arrays.milf delete mode 100644 test-suite/tests/valid/arrays.toml create mode 100644 test-suite/tests/valid/bool.milf delete mode 100644 test-suite/tests/valid/bool.toml create mode 100644 test-suite/tests/valid/comments-everywhere.milf delete mode 100644 test-suite/tests/valid/comments-everywhere.toml create mode 100644 test-suite/tests/valid/datetime-truncate.milf delete mode 100644 test-suite/tests/valid/datetime-truncate.toml create mode 100644 test-suite/tests/valid/datetime.milf delete mode 100644 test-suite/tests/valid/datetime.toml create mode 100644 test-suite/tests/valid/dotted-keys.milf delete mode 100644 test-suite/tests/valid/dotted-keys.toml create mode 100644 test-suite/tests/valid/empty.milf delete mode 100644 test-suite/tests/valid/empty.toml create mode 100644 test-suite/tests/valid/example-bom.milf delete mode 100644 test-suite/tests/valid/example-bom.toml create mode 100644 test-suite/tests/valid/example-v0.3.0.milf delete mode 100644 test-suite/tests/valid/example-v0.3.0.toml create mode 100644 test-suite/tests/valid/example-v0.4.0.milf delete mode 100644 test-suite/tests/valid/example-v0.4.0.toml create mode 100644 test-suite/tests/valid/example.milf delete mode 100644 test-suite/tests/valid/example.toml create mode 100644 test-suite/tests/valid/example2.milf delete mode 100644 test-suite/tests/valid/example2.toml create mode 100644 test-suite/tests/valid/float-exponent.milf delete mode 100644 test-suite/tests/valid/float-exponent.toml create mode 100644 test-suite/tests/valid/float.milf delete mode 100644 test-suite/tests/valid/float.toml create mode 100644 test-suite/tests/valid/hard_example.milf delete mode 100644 test-suite/tests/valid/hard_example.toml create mode 100644 test-suite/tests/valid/implicit-and-explicit-after.milf delete mode 100644 test-suite/tests/valid/implicit-and-explicit-after.toml create mode 100644 test-suite/tests/valid/implicit-and-explicit-before.milf delete mode 100644 test-suite/tests/valid/implicit-and-explicit-before.toml create mode 100644 test-suite/tests/valid/implicit-groups.milf delete mode 100644 test-suite/tests/valid/implicit-groups.toml create mode 100644 test-suite/tests/valid/integer.milf delete mode 100644 test-suite/tests/valid/integer.toml create mode 100644 test-suite/tests/valid/key-equals-nospace.milf delete mode 100644 test-suite/tests/valid/key-equals-nospace.toml create mode 100644 test-suite/tests/valid/key-quote-newline.milf delete mode 100644 test-suite/tests/valid/key-quote-newline.toml create mode 100644 test-suite/tests/valid/key-space.milf delete mode 100644 test-suite/tests/valid/key-space.toml create mode 100644 test-suite/tests/valid/key-special-chars.milf delete mode 100644 test-suite/tests/valid/key-special-chars.toml create mode 100644 test-suite/tests/valid/key-with-pound.milf delete mode 100644 test-suite/tests/valid/key-with-pound.toml create mode 100644 test-suite/tests/valid/long-float.milf delete mode 100644 test-suite/tests/valid/long-float.toml create mode 100644 test-suite/tests/valid/long-integer.milf delete mode 100644 test-suite/tests/valid/long-integer.toml create mode 100644 test-suite/tests/valid/multiline-string.milf delete mode 100644 test-suite/tests/valid/multiline-string.toml create mode 100644 test-suite/tests/valid/quote-surrounded-value.milf delete mode 100644 test-suite/tests/valid/quote-surrounded-value.toml create mode 100644 test-suite/tests/valid/raw-multiline-string.milf delete mode 100644 test-suite/tests/valid/raw-multiline-string.toml create mode 100644 test-suite/tests/valid/raw-string.milf delete mode 100644 test-suite/tests/valid/raw-string.toml create mode 100644 test-suite/tests/valid/string-delim-end.milf delete mode 100644 test-suite/tests/valid/string-delim-end.toml create mode 100644 test-suite/tests/valid/string-empty.milf delete mode 100644 test-suite/tests/valid/string-empty.toml create mode 100644 test-suite/tests/valid/string-escapes.milf delete mode 100644 test-suite/tests/valid/string-escapes.toml create mode 100644 test-suite/tests/valid/string-simple.milf delete mode 100644 test-suite/tests/valid/string-simple.toml create mode 100644 test-suite/tests/valid/string-with-pound.milf delete mode 100644 test-suite/tests/valid/string-with-pound.toml create mode 100644 test-suite/tests/valid/table-array-implicit.milf delete mode 100644 test-suite/tests/valid/table-array-implicit.toml create mode 100644 test-suite/tests/valid/table-array-many.milf delete mode 100644 test-suite/tests/valid/table-array-many.toml create mode 100644 test-suite/tests/valid/table-array-nest-no-keys.milf delete mode 100644 test-suite/tests/valid/table-array-nest-no-keys.toml create mode 100644 test-suite/tests/valid/table-array-nest.milf delete mode 100644 test-suite/tests/valid/table-array-nest.toml create mode 100644 test-suite/tests/valid/table-array-one.milf delete mode 100644 test-suite/tests/valid/table-array-one.toml create mode 100644 test-suite/tests/valid/table-empty.milf delete mode 100644 test-suite/tests/valid/table-empty.toml create mode 100644 test-suite/tests/valid/table-multi-empty.milf delete mode 100644 test-suite/tests/valid/table-multi-empty.toml create mode 100644 test-suite/tests/valid/table-sub-empty.milf delete mode 100644 test-suite/tests/valid/table-sub-empty.toml create mode 100644 test-suite/tests/valid/table-whitespace.milf delete mode 100644 test-suite/tests/valid/table-whitespace.toml create mode 100644 test-suite/tests/valid/table-with-pound.milf delete mode 100644 test-suite/tests/valid/table-with-pound.toml create mode 100644 test-suite/tests/valid/unicode-escape.milf delete mode 100644 test-suite/tests/valid/unicode-escape.toml create mode 100644 test-suite/tests/valid/unicode-literal.milf delete mode 100644 test-suite/tests/valid/unicode-literal.toml diff --git a/Cargo.toml b/Cargo.toml index 131ebaf..3c7a665 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,15 @@ [package] -name = "toml" +name = "milf" version = "0.5.8" -authors = ["Alex Crichton "] +authors = ["boringcactus "] license = "MIT/Apache-2.0" readme = "README.md" keywords = ["encoding"] -repository = "https://github.com/alexcrichton/toml-rs" -homepage = "https://github.com/alexcrichton/toml-rs" -documentation = "https://docs.rs/toml" +repository = "https://code.boringcactus.com/misc/milf-rs/" +documentation = "https://docs.rs/milf" description = """ -A native Rust encoder and decoder of TOML-formatted files and streams. Provides -implementations of the standard Serialize/Deserialize traits for TOML data to +A native Rust encoder and decoder of My INI-Like Format (MILF)-formatted files and streams. Provides +implementations of the standard Serialize/Deserialize traits for MILF data to facilitate deserializing and serializing Rust structures. """ categories = ["config", "encoding", "parser-implementations"] @@ -30,7 +29,7 @@ serde_json = "1.0" [features] default = [] -# Use indexmap rather than BTreeMap as the map type of toml::Value. -# This allows data to be read into a Value and written back to a TOML string +# Use indexmap rather than BTreeMap as the map type of milf::Value. +# This allows data to be read into a Value and written back to a MILF string # while preserving the order of map keys in the input. preserve_order = ["indexmap"] diff --git a/README.md b/README.md index 21dd108..e8ea5c6 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,23 @@ -# toml-rs +# milf-rs -[![Latest Version](https://img.shields.io/crates/v/toml.svg)](https://crates.io/crates/toml) -[![Documentation](https://docs.rs/toml/badge.svg)](https://docs.rs/toml) +[![Latest Version](https://img.shields.io/crates/v/milf.svg)](https://crates.io/crates/milf) +[![Documentation](https://docs.rs/milf/badge.svg)](https://docs.rs/milf) -A [TOML][toml] decoder and encoder for Rust. This library is currently compliant -with the v0.5.0 version of TOML. This library will also likely continue to stay -up to date with the TOML specification as changes happen. +A [My INI-Like Format (MILF)][toml] decoder and encoder for Rust. This library is currently compliant +with the v0.5.0 version of MILF. This library will also likely continue to stay +up to date with the MILF specification as changes happen. [toml]: https://github.com/toml-lang/toml ```toml -# Cargo.toml +# Cargo.milf [dependencies] -toml = "0.5" +milf = "0.5" ``` This crate also supports serialization/deserialization through the [serde](https://serde.rs) crate on crates.io. Currently the older `rustc-serialize` -crate is not supported in the 0.3+ series of the `toml` crate, but 0.2 can be +crate is not supported in the 0.3+ series of the `milf` crate, but 0.2 can be used for that support. # License @@ -33,6 +33,4 @@ at your option. ### Contribution -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in toml-rs by you, as defined in the Apache-2.0 license, shall be -dual licensed as above, without any additional terms or conditions. +Don't contribute to this. diff --git a/examples/decode.rs b/examples/decode.rs index b5d6a99..63fb315 100644 --- a/examples/decode.rs +++ b/examples/decode.rs @@ -1,12 +1,12 @@ //! An example showing off the usage of `Deserialize` to automatically decode -//! TOML into a Rust `struct` +//! MILF into a Rust `struct` #![deny(warnings)] use serde_derive::Deserialize; /// This is what we're going to decode into. Each field is optional, meaning -/// that it doesn't have to be present in TOML. +/// that it doesn't have to be present in MILF. #[derive(Debug, Deserialize)] struct Config { global_string: Option, @@ -32,7 +32,7 @@ struct PeerConfig { } fn main() { - let toml_str = r#" + let milf_str = r#" global_string = "test" global_integer = 5 @@ -48,6 +48,6 @@ fn main() { ip = "127.0.0.1" "#; - let decoded: Config = toml::from_str(toml_str).unwrap(); + let decoded: Config = milf::from_str(milf_str).unwrap(); println!("{:#?}", decoded); } diff --git a/examples/enum_external.rs b/examples/enum_external.rs index a7dd84a..4cddabb 100644 --- a/examples/enum_external.rs +++ b/examples/enum_external.rs @@ -1,5 +1,5 @@ //! An example showing off the usage of `Deserialize` to automatically decode -//! TOML into a Rust `struct`, with enums. +//! MILF into a Rust `struct`, with enums. #![deny(warnings)] @@ -26,7 +26,7 @@ enum MyEnum { } fn main() { - let toml_str = r#" + let milf_str = r#" plain = "Plain" plain_table = { Plain = {} } tuple = { Tuple = { 0 = 123, 1 = true } } @@ -39,6 +39,6 @@ fn main() { { Struct = { value = 123 } } ]"#; - let decoded: Config = toml::from_str(toml_str).unwrap(); + let decoded: Config = milf::from_str(milf_str).unwrap(); println!("{:#?}", decoded); } diff --git a/examples/toml2json.rs b/examples/toml2json.rs index 1b90c9f..6e02e8b 100644 --- a/examples/toml2json.rs +++ b/examples/toml2json.rs @@ -6,7 +6,7 @@ use std::io; use std::io::prelude::*; use serde_json::Value as Json; -use toml::Value as Toml; +use milf::Value as Milf; fn main() { let mut args = env::args(); @@ -21,27 +21,27 @@ fn main() { } match input.parse() { - Ok(toml) => { - let json = convert(toml); + Ok(milf) => { + let json = convert(milf); println!("{}", serde_json::to_string_pretty(&json).unwrap()); } - Err(error) => println!("failed to parse TOML: {}", error), + Err(error) => println!("failed to parse MILF: {}", error), } } -fn convert(toml: Toml) -> Json { - match toml { - Toml::String(s) => Json::String(s), - Toml::Integer(i) => Json::Number(i.into()), - Toml::Float(f) => { +fn convert(milf: Milf) -> Json { + match milf { + Milf::String(s) => Json::String(s), + Milf::Integer(i) => Json::Number(i.into()), + Milf::Float(f) => { let n = serde_json::Number::from_f64(f).expect("float infinite and nan not allowed"); Json::Number(n) } - Toml::Boolean(b) => Json::Bool(b), - Toml::Array(arr) => Json::Array(arr.into_iter().map(convert).collect()), - Toml::Table(table) => { + Milf::Boolean(b) => Json::Bool(b), + Milf::Array(arr) => Json::Array(arr.into_iter().map(convert).collect()), + Milf::Table(table) => { Json::Object(table.into_iter().map(|(k, v)| (k, convert(v))).collect()) } - Toml::Datetime(dt) => Json::String(dt.to_string()), + Milf::Datetime(dt) => Json::String(dt.to_string()), } } diff --git a/src/datetime.rs b/src/datetime.rs index 1f68bfd..2445c48 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -4,22 +4,22 @@ use std::str::{self, FromStr}; use serde::{de, ser}; -/// A parsed TOML datetime value +/// A parsed MILF datetime value /// /// This structure is intended to represent the datetime primitive type that can -/// be encoded into TOML documents. This type is a parsed version that contains +/// be encoded into MILF documents. This type is a parsed version that contains /// all metadata internally. /// /// Currently this type is intentionally conservative and only supports /// `to_string` as an accessor. Over time though it's intended that it'll grow /// more support! /// -/// Note that if you're using `Deserialize` to deserialize a TOML document, you +/// Note that if you're using `Deserialize` to deserialize a MILF document, you /// can use this as a placeholder for where you're expecting a datetime to be /// specified. /// /// Also note though that while this type implements `Serialize` and -/// `Deserialize` it's only recommended to use this type with the TOML format, +/// `Deserialize` it's only recommended to use this type with the MILF format, /// otherwise encoded in other formats it may look a little odd. #[derive(PartialEq, Clone)] pub struct Datetime { @@ -38,10 +38,10 @@ pub struct DatetimeParseError { // to a special valid in the serde data model. Namely one with these special // fields/struct names. // -// In general the TOML encoder/decoder will catch this and not literally emit +// In general the MILF encoder/decoder will catch this and not literally emit // these strings but rather emit datetimes as they're intended. -pub const FIELD: &str = "$__toml_private_datetime"; -pub const NAME: &str = "$__toml_private_Datetime"; +pub const FIELD: &str = "$__milf_private_datetime"; +pub const NAME: &str = "$__milf_private_Datetime"; #[derive(PartialEq, Clone)] struct Date { @@ -329,7 +329,7 @@ impl<'de> de::Deserialize<'de> for Datetime { type Value = Datetime; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str("a TOML datetime") + formatter.write_str("a MILF datetime") } fn visit_map(self, mut visitor: V) -> Result diff --git a/src/de.rs b/src/de.rs index 6411293..31904b5 100644 --- a/src/de.rs +++ b/src/de.rs @@ -1,6 +1,6 @@ -//! Deserializing TOML into Rust structures. +//! Deserializing MILF into Rust structures. //! -//! This module contains all the Serde support for deserializing TOML documents +//! This module contains all the Serde support for deserializing MILF documents //! into Rust structures. Note that some top-level functions here are also //! provided at the top of the crate. @@ -22,13 +22,13 @@ use crate::datetime; use crate::spanned; use crate::tokens::{Error as TokenError, Span, Token, Tokenizer}; -/// Type Alias for a TOML Table pair +/// Type Alias for a MILF Table pair type TablePair<'a> = ((Span, Cow<'a, str>), Value<'a>); /// Deserializes a byte slice into a type. /// /// This function will attempt to interpret `bytes` as UTF-8 data and then -/// deserialize `T` from the TOML document provided. +/// deserialize `T` from the MILF document provided. pub fn from_slice<'de, T>(bytes: &'de [u8]) -> Result where T: de::Deserialize<'de>, @@ -41,7 +41,7 @@ where /// Deserializes a string into a type. /// -/// This function will attempt to interpret `s` as a TOML document and +/// This function will attempt to interpret `s` as a MILF document and /// deserialize `T` from the document. /// /// # Examples @@ -61,14 +61,14 @@ where /// } /// /// fn main() { -/// let config: Config = toml::from_str(r#" -/// title = 'TOML Example' +/// let config: Config = milf::from_str(r#" +/// title = 'MILF Example' /// /// [owner] /// name = 'Lisa' /// "#).unwrap(); /// -/// assert_eq!(config.title, "TOML Example"); +/// assert_eq!(config.title, "MILF Example"); /// assert_eq!(config.owner.name, "Lisa"); /// } /// ``` @@ -198,7 +198,7 @@ enum ErrorKind { __Nonexhaustive, } -/// Deserialization implementation for TOML. +/// Deserialization implementation for MILF. pub struct Deserializer<'a> { require_newline_after_table: bool, allow_duplciate_after_longer_table: bool, @@ -231,7 +231,7 @@ impl<'de, 'b> de::Deserializer<'de> for &'b mut Deserializer<'de> { de: self, }); res.map_err(|mut err| { - // Errors originating from this library (toml), have an offset + // Errors originating from this library (milf), have an offset // attached to them already. Other errors, like those originating // from serde (like "missing field") or from a custom deserializer, // do not have offsets on them. Here, we do a best guess at their @@ -444,7 +444,7 @@ impl<'de, 'b> de::MapAccess<'de> for MapVisitor<'de, 'b> { self.cur = pos; // Test to see if we're duplicating our parent's table, and if so - // then this is an error in the toml format + // then this is an error in the milf format if self.cur_parent != pos { if headers_equal( &self.tables[self.cur_parent].header, @@ -647,7 +647,7 @@ impl<'de, 'b> de::Deserializer<'de> for MapVisitor<'de, 'b> { && !(self.array && !self.values.peek().is_none()) { // TODO we can't actually emit spans here for the *entire* table/array - // due to the format that toml uses. Setting the start and end to 0 is + // due to the format that milf uses. Setting the start and end to 0 is // *detectable* (and no reasonable span would look like that), // it would be better to expose this in the API via proper // ADTs like Option. @@ -1283,22 +1283,22 @@ impl<'a> Deserializer<'a> { Ok(()) } - /// Historical versions of toml-rs accidentally allowed a newline after a - /// table definition, but the TOML spec requires a newline after a table + /// Historical versions of milf-rs accidentally allowed a newline after a + /// table definition, but the MILF spec requires a newline after a table /// definition header. /// /// This option can be set to `false` (the default is `true`) to emulate - /// this behavior for backwards compatibility with older toml-rs versions. + /// this behavior for backwards compatibility with older milf-rs versions. pub fn set_require_newline_after_table(&mut self, require: bool) { self.require_newline_after_table = require; } - /// Historical versions of toml-rs accidentally allowed a duplicate table + /// Historical versions of milf-rs accidentally allowed a duplicate table /// header after a longer table header was previously defined. This is - /// invalid according to the TOML spec, however. + /// invalid according to the MILF spec, however. /// /// This option can be set to `true` (the default is `false`) to emulate - /// this behavior for backwards compatibility with older toml-rs versions. + /// this behavior for backwards compatibility with older milf-rs versions. pub fn set_allow_duplicate_after_longer_table(&mut self, allow: bool) { self.allow_duplciate_after_longer_table = allow; } @@ -2148,7 +2148,7 @@ impl fmt::Display for Error { )?, ErrorKind::UnquotedString => write!( f, - "invalid TOML value, did you mean to use a quoted string?" + "invalid MILF value, did you mean to use a quoted string?" )?, ErrorKind::__Nonexhaustive => panic!(), } diff --git a/src/lib.rs b/src/lib.rs index 00421b1..bb49225 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,14 @@ -//! A [TOML]-parsing library +//! A [My INI-Like Format (MILF)]-parsing library //! -//! This library implements a [TOML] v0.5.0 compatible parser, +//! This library implements a [MILF] v0.5.0 compatible parser, //! primarily supporting the [`serde`] library for encoding/decoding //! various types in Rust. //! -//! TOML itself is a simple, ergonomic, and readable configuration format: +//! MILF itself is a simple, ergonomic, and readable configuration format: //! //! ```toml //! [package] -//! name = "toml" +//! name = "milf" //! version = "0.4.2" //! authors = ["Alex Crichton "] //! @@ -16,12 +16,12 @@ //! serde = "1.0" //! ``` //! -//! The TOML format tends to be relatively common throughout the Rust community +//! The MILF format tends to be relatively common throughout the Rust community //! for configuration, notably being used by [Cargo], Rust's package manager. //! -//! ## TOML values +//! ## MILF values //! -//! A value in TOML is represented with the [`Value`] enum in this crate: +//! A value in MILF is represented with the [`Value`] enum in this crate: //! //! ```rust,ignore //! pub enum Value { @@ -35,16 +35,16 @@ //! } //! ``` //! -//! TOML is similar to JSON with the notable addition of a [`Datetime`] -//! type. In general, TOML and JSON are interchangeable in terms of +//! MILF is similar to JSON with the notable addition of a [`Datetime`] +//! type. In general, MILF and JSON are interchangeable in terms of //! formats. //! -//! ## Parsing TOML +//! ## Parsing MILF //! -//! The easiest way to parse a TOML document is via the [`Value`] type: +//! The easiest way to parse a MILF document is via the [`Value`] type: //! //! ```rust -//! use toml::Value; +//! use milf::Value; //! //! let value = "foo = 'bar'".parse::().unwrap(); //! @@ -74,7 +74,7 @@ //! use the [`Deserializer`], [`Serializer`], or [`Value`] type itself to act as //! a deserializer/serializer for arbitrary types. //! -//! An example of deserializing with TOML is: +//! An example of deserializing with MILF is: //! //! ```rust //! use serde_derive::Deserialize; @@ -93,7 +93,7 @@ //! } //! //! fn main() { -//! let config: Config = toml::from_str(r#" +//! let config: Config = milf::from_str(r#" //! ip = '127.0.0.1' //! //! [keys] @@ -136,15 +136,15 @@ //! }, //! }; //! -//! let toml = toml::to_string(&config).unwrap(); +//! let milf = milf::to_string(&config).unwrap(); //! } //! ``` //! -//! [TOML]: https://github.com/toml-lang/toml +//! [MILF]: https://github.com/toml-lang/toml //! [Cargo]: https://crates.io/ //! [`serde`]: https://serde.rs/ -#![doc(html_root_url = "https://docs.rs/toml/0.5")] +#![doc(html_root_url = "https://docs.rs/milf/0.5")] #![deny(missing_docs)] #![warn(rust_2018_idioms)] // Makes rustc abort compilation if there are any unsafe blocks in the crate. diff --git a/src/macros.rs b/src/macros.rs index 0731afe..ed719ae 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -2,15 +2,15 @@ pub use serde::de::{Deserialize, IntoDeserializer}; use crate::value::{Array, Table, Value}; -/// Construct a [`toml::Value`] from TOML syntax. +/// Construct a [`milf::Value`] from MILF syntax. /// -/// [`toml::Value`]: value/enum.Value.html +/// [`milf::Value`]: value/enum.Value.html /// /// ```rust /// fn main() { -/// let cargo_toml = toml::toml! { +/// let cargo_milf = milf::milf! { /// [package] -/// name = "toml" +/// name = "milf" /// version = "0.4.5" /// authors = ["Alex Crichton "] /// @@ -25,20 +25,20 @@ use crate::value::{Array, Table, Value}; /// serde_json = "1.0" /// }; /// -/// println!("{:#?}", cargo_toml); +/// println!("{:#?}", cargo_milf); /// } /// ``` #[macro_export] -macro_rules! toml { - ($($toml:tt)+) => {{ +macro_rules! milf { + ($($milf:tt)+) => {{ let table = $crate::value::Table::new(); let mut root = $crate::Value::Table(table); - $crate::toml_internal!(@toplevel root [] $($toml)+); + $crate::milf_internal!(@toplevel root [] $($milf)+); root }}; } -// TT-muncher to parse TOML syntax into a toml::Value. +// TT-muncher to parse MILF syntax into a milf::Value. // // @toplevel -- Parse tokens outside of an inline table or inline array. In // this state, `[table headers]` and `[[array headers]]` are @@ -55,13 +55,13 @@ macro_rules! toml { // primitive or inline table or inline array. // // @table -- Parse the contents of an inline table, returning them as a -// toml::Value::Table. +// milf::Value::Table. // // @tabledatetime -- Helper to parse a Datetime from string and insert it // into a table, continuing in the @table state. // // @array -- Parse the contents of an inline array, returning them as a -// toml::Value::Array. +// milf::Value::Array. // // @arraydatetime -- Helper to parse a Datetime from string and push it into // an array, continuing in the @array state. @@ -72,105 +72,105 @@ macro_rules! toml { // #[macro_export] #[doc(hidden)] -macro_rules! toml_internal { +macro_rules! milf_internal { // Base case, no elements remaining. (@toplevel $root:ident [$($path:tt)*]) => {}; // Parse negative number `key = -value`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = - $v:tt $($rest:tt)*) => { - $crate::toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = (-$v) $($rest)*); + $crate::milf_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = (-$v) $($rest)*); }; // Parse positive number `key = +value`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = + $v:tt $($rest:tt)*) => { - $crate::toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = ($v) $($rest)*); + $crate::milf_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = ($v) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00.999999-07:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00-07:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `key = 1979-05-27T00:32:00.999999`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T07:32:00Z` and local datetime `key = 1979-05-27T07:32:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `key = 1979-05-27`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); }; // Parse local time `key = 00:32:00.999999`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `key = 07:32:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); }; // Parse any other `key = value` including string, inline array, inline // table, number, and boolean. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $v:tt $($rest:tt)*) => {{ - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$($path)* $(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], - $crate::toml_internal!(@value $v)); - $crate::toml_internal!(@toplevel $root [$($path)*] $($rest)*); + &[$($path)* $(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], + $crate::milf_internal!(@value $v)); + $crate::milf_internal!(@toplevel $root [$($path)*] $($rest)*); }}; // Parse array header `[[bin]]`. (@toplevel $root:ident $oldpath:tt [[$($($path:tt)-+).+]] $($rest:tt)*) => { - $crate::macros::push_toml( + $crate::macros::push_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+]); - $crate::toml_internal!(@toplevel $root [$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+] $($rest)*); + &[$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+]); + $crate::milf_internal!(@toplevel $root [$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+] $($rest)*); }; // Parse table header `[patch.crates-io]`. (@toplevel $root:ident $oldpath:tt [$($($path:tt)-+).+] $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+], + &[$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+], $crate::Value::Table($crate::value::Table::new())); - $crate::toml_internal!(@toplevel $root [$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+] $($rest)*); + $crate::milf_internal!(@toplevel $root [$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+] $($rest)*); }; // Parse datetime from string and insert into table. (@topleveldatetime $root:ident [$($path:tt)*] $($($k:tt)-+).+ = ($($datetime:tt)+) $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$($path)* $(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], + &[$($path)* $(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], $crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - $crate::toml_internal!(@toplevel $root [$($path)*] $($rest)*); + $crate::milf_internal!(@toplevel $root [$($path)*] $($rest)*); }; // Turn a path segment into a string. @@ -187,14 +187,14 @@ macro_rules! toml_internal { // Construct a Value from an inline table. (@value { $($inline:tt)* }) => {{ let mut table = $crate::Value::Table($crate::value::Table::new()); - $crate::toml_internal!(@trailingcomma (@table table) $($inline)*); + $crate::milf_internal!(@trailingcomma (@table table) $($inline)*); table }}; // Construct a Value from an inline array. (@value [ $($inline:tt)* ]) => {{ let mut array = $crate::value::Array::new(); - $crate::toml_internal!(@trailingcomma (@array array) $($inline)*); + $crate::milf_internal!(@trailingcomma (@array array) $($inline)*); $crate::Value::Array(array) }}; @@ -234,81 +234,81 @@ macro_rules! toml_internal { // Parse negative number `key = -value`. (@table $root:ident $($($k:tt)-+).+ = - $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@table $root $($($k)-+).+ = (-$v) , $($rest)*); + $crate::milf_internal!(@table $root $($($k)-+).+ = (-$v) , $($rest)*); }; // Parse positive number `key = +value`. (@table $root:ident $($($k:tt)-+).+ = + $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@table $root $($($k)-+).+ = ($v) , $($rest)*); + $crate::milf_internal!(@table $root $($($k)-+).+ = ($v) , $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00.999999-07:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00-07:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `key = 1979-05-27T00:32:00.999999`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T07:32:00Z` and local datetime `key = 1979-05-27T07:32:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `key = 1979-05-27`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); }; // Parse local time `key = 00:32:00.999999`. (@table $root:ident $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `key = 07:32:00`. (@table $root:ident $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); }; // Parse any other type, probably string or boolean or number. (@table $root:ident $($($k:tt)-+).+ = $v:tt , $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], - $crate::toml_internal!(@value $v)); - $crate::toml_internal!(@table $root $($rest)*); + &[$(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], + $crate::milf_internal!(@value $v)); + $crate::milf_internal!(@table $root $($rest)*); }; // Parse a Datetime from string and continue in @table state. (@tabledatetime $root:ident $($($k:tt)-+).+ = ($($datetime:tt)*) $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], + &[$(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], $crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - $crate::toml_internal!(@table $root $($rest)*); + $crate::milf_internal!(@table $root $($rest)*); }; // Base case of inline array. @@ -316,107 +316,107 @@ macro_rules! toml_internal { // Parse negative number `-value`. (@array $root:ident - $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@array $root (-$v) , $($rest)*); + $crate::milf_internal!(@array $root (-$v) , $($rest)*); }; // Parse positive number `+value`. (@array $root:ident + $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@array $root ($v) , $($rest)*); + $crate::milf_internal!(@array $root ($v) , $($rest)*); }; // Parse offset datetime `1979-05-27T00:32:00.999999-07:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `1979-05-27T00:32:00-07:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `1979-05-27T00:32:00.999999`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `1979-05-27T07:32:00Z` and local datetime `1979-05-27T07:32:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `1979-05-27`. (@array $root:ident $yr:tt - $mo:tt - $day:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day) $($rest)*); }; // Parse local time `00:32:00.999999`. (@array $root:ident $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `07:32:00`. (@array $root:ident $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($hr : $min : $sec) $($rest)*); }; // Parse any other type, probably string or boolean or number. (@array $root:ident $v:tt , $($rest:tt)*) => { - $root.push($crate::toml_internal!(@value $v)); - $crate::toml_internal!(@array $root $($rest)*); + $root.push($crate::milf_internal!(@value $v)); + $crate::milf_internal!(@array $root $($rest)*); }; // Parse a Datetime from string and continue in @array state. (@arraydatetime $root:ident ($($datetime:tt)*) $($rest:tt)*) => { $root.push($crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - $crate::toml_internal!(@array $root $($rest)*); + $crate::milf_internal!(@array $root $($rest)*); }; // No trailing comma required if the tokens are empty. (@trailingcomma ($($args:tt)*)) => { - $crate::toml_internal!($($args)*); + $crate::milf_internal!($($args)*); }; // Tokens end with a trailing comma, do not append another one. (@trailingcomma ($($args:tt)*) ,) => { - $crate::toml_internal!($($args)* ,); + $crate::milf_internal!($($args)* ,); }; // Tokens end with something other than comma, append a trailing comma. (@trailingcomma ($($args:tt)*) $last:tt) => { - $crate::toml_internal!($($args)* $last ,); + $crate::milf_internal!($($args)* $last ,); }; // Not yet at the last token. (@trailingcomma ($($args:tt)*) $first:tt $($rest:tt)+) => { - $crate::toml_internal!(@trailingcomma ($($args)* $first) $($rest)+); + $crate::milf_internal!(@trailingcomma ($($args)* $first) $($rest)+); }; } // Called when parsing a `key = value` pair. // Inserts an entry into the table at the given path. -pub fn insert_toml(root: &mut Value, path: &[&str], value: Value) { +pub fn insert_milf(root: &mut Value, path: &[&str], value: Value) { *traverse(root, path) = value; } // Called when parsing an `[[array header]]`. // Pushes an empty table onto the array at the given path. -pub fn push_toml(root: &mut Value, path: &[&str]) { +pub fn push_milf(root: &mut Value, path: &[&str]) { let target = traverse(root, path); if !target.is_array() { *target = Value::Array(Array::new()); @@ -434,7 +434,7 @@ fn traverse<'a>(root: &'a mut Value, path: &[&str]) -> &'a mut Value { let cur1 = cur; let cur2; - // From the TOML spec: + // From the MILF spec: // // > Each double-bracketed sub-table will belong to the most recently // > defined table element above it. diff --git a/src/map.rs b/src/map.rs index d130a1d..363433f 100644 --- a/src/map.rs +++ b/src/map.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! A map of String to toml::Value. +//! A map of String to milf::Value. //! //! By default the map is backed by a [`BTreeMap`]. Enable the `preserve_order` -//! feature of toml-rs to use [`LinkedHashMap`] instead. +//! feature of milf-rs to use [`LinkedHashMap`] instead. //! //! [`BTreeMap`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html //! [`LinkedHashMap`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html @@ -28,7 +28,7 @@ use std::collections::{btree_map, BTreeMap}; #[cfg(feature = "preserve_order")] use indexmap::{self, IndexMap}; -/// Represents a TOML key/value type. +/// Represents a MILF key/value type. pub struct Map { map: MapImpl, } @@ -504,7 +504,7 @@ impl<'a> IntoIterator for &'a Map { } } -/// An iterator over a toml::Map's entries. +/// An iterator over a milf::Map's entries. pub struct Iter<'a> { iter: IterImpl<'a>, } @@ -529,7 +529,7 @@ impl<'a> IntoIterator for &'a mut Map { } } -/// A mutable iterator over a toml::Map's entries. +/// A mutable iterator over a milf::Map's entries. pub struct IterMut<'a> { iter: IterMutImpl<'a>, } @@ -554,7 +554,7 @@ impl IntoIterator for Map { } } -/// An owning iterator over a toml::Map's entries. +/// An owning iterator over a milf::Map's entries. pub struct IntoIter { iter: IntoIterImpl, } @@ -568,7 +568,7 @@ delegate_iterator!((IntoIter) => (String, Value)); ////////////////////////////////////////////////////////////////////////////// -/// An iterator over a toml::Map's keys. +/// An iterator over a milf::Map's keys. pub struct Keys<'a> { iter: KeysImpl<'a>, } @@ -582,7 +582,7 @@ delegate_iterator!((Keys<'a>) => &'a String); ////////////////////////////////////////////////////////////////////////////// -/// An iterator over a toml::Map's values. +/// An iterator over a milf::Map's values. pub struct Values<'a> { iter: ValuesImpl<'a>, } diff --git a/src/ser.rs b/src/ser.rs index e115541..dda84fb 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -1,10 +1,10 @@ -//! Serializing Rust structures into TOML. +//! Serializing Rust structures into MILF. //! //! This module contains all the Serde support for serializing Rust structures -//! into TOML documents (as strings). Note that some top-level functions here +//! into MILF documents (as strings). Note that some top-level functions here //! are also provided at the top of the crate. //! -//! Note that the TOML format has a restriction that if a table itself contains +//! Note that the MILF format has a restriction that if a table itself contains //! tables, all keys with non-table values must be emitted first. This is //! typically easy to ensure happens when you're defining a `struct` as you can //! reorder the fields manually, but when working with maps (such as `BTreeMap` @@ -17,7 +17,7 @@ //! #[derive(Serialize)] //! struct Manifest { //! package: Package, -//! #[serde(serialize_with = "toml::ser::tables_last")] +//! #[serde(serialize_with = "milf::ser::tables_last")] //! dependencies: HashMap, //! } //! # type Package = String; @@ -34,7 +34,7 @@ use std::rc::Rc; use crate::datetime; use serde::ser; -/// Serialize the given data structure as a TOML byte vector. +/// Serialize the given data structure as a MILF byte vector. /// /// Serialization can fail if `T`'s implementation of `Serialize` decides to /// fail, if `T` contains a map with non-string keys, or if `T` attempts to @@ -46,7 +46,7 @@ where to_string(value).map(|e| e.into_bytes()) } -/// Serialize the given data structure as a String of TOML. +/// Serialize the given data structure as a String of MILF. /// /// Serialization can fail if `T`'s implementation of `Serialize` decides to /// fail, if `T` contains a map with non-string keys, or if `T` attempts to @@ -80,8 +80,8 @@ where /// }, /// }; /// -/// let toml = toml::to_string(&config).unwrap(); -/// println!("{}", toml) +/// let milf = milf::to_string(&config).unwrap(); +/// println!("{}", milf) /// } /// ``` pub fn to_string(value: &T) -> Result @@ -93,7 +93,7 @@ where Ok(dst) } -/// Serialize the given data structure as a "pretty" String of TOML. +/// Serialize the given data structure as a "pretty" String of MILF. /// /// This is identical to `to_string` except the output string has a more /// "pretty" output. See `Serializer::pretty` for more details. @@ -112,11 +112,11 @@ pub enum Error { /// Indicates that a Rust type was requested to be serialized but it was not /// supported. /// - /// Currently the TOML format does not support serializing types such as + /// Currently the MILF format does not support serializing types such as /// enums, tuples and tuple structs. UnsupportedType, - /// The key of all TOML maps must be strings, but serialization was + /// The key of all MILF maps must be strings, but serialization was /// attempted where the key of a map was not a string. KeyNotString, @@ -128,7 +128,7 @@ pub enum Error { #[doc(hidden)] ArrayMixedType, - /// All values in a TOML table must be emitted before further tables are + /// All values in a MILF table must be emitted before further tables are /// emitted. If a value is emitted *after* a table then this error is /// generated. ValueAfterTable, @@ -186,10 +186,10 @@ struct Settings { string: Option, } -/// Serialization implementation for TOML. +/// Serialization implementation for MILF. /// -/// This structure implements serialization support for TOML to serialize an -/// arbitrary type to TOML. Note that the TOML format does not support all +/// This structure implements serialization support for MILF to serialize an +/// arbitrary type to MILF. Note that the MILF format does not support all /// datatypes in Rust, such as enums, tuples, and tuple structs. These types /// will generate an error when serialized. /// @@ -244,7 +244,7 @@ pub enum SerializeTable<'a, 'b> { } impl<'a> Serializer<'a> { - /// Creates a new serializer which will emit TOML into the buffer provided. + /// Creates a new serializer which will emit MILF into the buffer provided. /// /// The serializer can then be used to serialize a type after which the data /// will be present in `dst`. @@ -1558,9 +1558,9 @@ enum Category { } /// Convenience function to serialize items in a map in an order valid with -/// TOML. +/// MILF. /// -/// TOML carries the restriction that keys in a table must be serialized last if +/// MILF carries the restriction that keys in a table must be serialized last if /// their value is a table itself. This isn't always easy to guarantee, so this /// helper can be used like so: /// @@ -1570,7 +1570,7 @@ enum Category { /// #[derive(Serialize)] /// struct Manifest { /// package: Package, -/// #[serde(serialize_with = "toml::ser::tables_last")] +/// #[serde(serialize_with = "milf::ser::tables_last")] /// dependencies: HashMap, /// } /// # type Package = String; diff --git a/src/spanned.rs b/src/spanned.rs index 9ee56ae..6c49eb9 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -4,16 +4,16 @@ use std::cmp::Ordering; use std::fmt; use std::hash::{Hash, Hasher}; -pub(crate) const NAME: &str = "$__toml_private_Spanned"; -pub(crate) const START: &str = "$__toml_private_start"; -pub(crate) const END: &str = "$__toml_private_end"; -pub(crate) const VALUE: &str = "$__toml_private_value"; +pub(crate) const NAME: &str = "$__milf_private_Spanned"; +pub(crate) const START: &str = "$__milf_private_start"; +pub(crate) const END: &str = "$__milf_private_end"; +pub(crate) const VALUE: &str = "$__milf_private_value"; /// A spanned value, indicating the range at which it is defined in the source. /// /// ``` /// use serde_derive::Deserialize; -/// use toml::Spanned; +/// use milf::Spanned; /// /// #[derive(Deserialize)] /// struct Value { @@ -23,7 +23,7 @@ pub(crate) const VALUE: &str = "$__toml_private_value"; /// fn main() { /// let t = "s = \"value\"\n"; /// -/// let u: Value = toml::from_str(t).unwrap(); +/// let u: Value = milf::from_str(t).unwrap(); /// /// assert_eq!(u.s.start(), 4); /// assert_eq!(u.s.end(), 11); @@ -122,7 +122,7 @@ where type Value = Spanned; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str("a TOML spanned") + formatter.write_str("a MILF spanned") } fn visit_map(self, mut visitor: V) -> Result, V::Error> diff --git a/src/value.rs b/src/value.rs index 38dfe1f..5bb0c55 100644 --- a/src/value.rs +++ b/src/value.rs @@ -1,4 +1,4 @@ -//! Definition of a TOML value +//! Definition of a MILF value use std::collections::{BTreeMap, HashMap}; use std::fmt; @@ -17,36 +17,36 @@ pub use crate::datetime::{Datetime, DatetimeParseError}; pub use crate::map::Map; -/// Representation of a TOML value. +/// Representation of a MILF value. #[derive(PartialEq, Clone, Debug)] pub enum Value { - /// Represents a TOML string + /// Represents a MILF string String(String), - /// Represents a TOML integer + /// Represents a MILF integer Integer(i64), - /// Represents a TOML float + /// Represents a MILF float Float(f64), - /// Represents a TOML boolean + /// Represents a MILF boolean Boolean(bool), - /// Represents a TOML datetime + /// Represents a MILF datetime Datetime(Datetime), - /// Represents a TOML array + /// Represents a MILF array Array(Array), - /// Represents a TOML table + /// Represents a MILF table Table(Table), } -/// Type representing a TOML array, payload of the `Value::Array` variant +/// Type representing a MILF array, payload of the `Value::Array` variant pub type Array = Vec; -/// Type representing a TOML table, payload of the `Value::Table` variant. +/// Type representing a MILF table, payload of the `Value::Table` variant. /// By default it is backed by a BTreeMap, enable the `preserve_order` feature /// to use a LinkedHashMap instead. pub type Table = Map; impl Value { - /// Convert a `T` into `toml::Value` which is an enum that can represent - /// any valid TOML data. + /// Convert a `T` into `milf::Value` which is an enum that can represent + /// any valid MILF data. /// /// This conversion can fail if `T`'s implementation of `Serialize` decides to /// fail, or if `T` contains a map with non-string keys. @@ -57,14 +57,14 @@ impl Value { value.serialize(Serializer) } - /// Interpret a `toml::Value` as an instance of type `T`. + /// Interpret a `milf::Value` as an instance of type `T`. /// /// This conversion can fail if the structure of the `Value` does not match the /// structure expected by `T`, for example if `T` is a struct type but the - /// `Value` contains something other than a TOML table. It can also fail if the + /// `Value` contains something other than a MILF table. It can also fail if the /// structure is correct but `T`'s implementation of `Deserialize` decides that /// something is wrong with the data, for example required struct fields are - /// missing from the TOML map or some number is too big to fit in the expected + /// missing from the MILF map or some number is too big to fit in the expected /// primitive type. pub fn try_into<'de, T>(self) -> Result where @@ -73,7 +73,7 @@ impl Value { de::Deserialize::deserialize(self) } - /// Index into a TOML array or map. A string index can be used to access a + /// Index into a MILF array or map. A string index can be used to access a /// value in a map, and a usize index can be used to access an element of an /// array. /// @@ -85,7 +85,7 @@ impl Value { index.index(self) } - /// Mutably index into a TOML array or map. A string index can be used to + /// Mutably index into a MILF array or map. A string index can be used to /// access a value in a map, and a usize index can be used to access an /// element of an array. /// @@ -151,7 +151,7 @@ impl Value { /// Extracts the datetime value if it is a datetime. /// - /// Note that a parsed TOML value will only contain ISO 8601 dates. An + /// Note that a parsed MILF value will only contain ISO 8601 dates. An /// example date is: /// /// ```notrust @@ -302,13 +302,13 @@ impl_into_value!(Boolean: bool); impl_into_value!(Datetime: Datetime); impl_into_value!(Table: Table); -/// Types that can be used to index a `toml::Value` +/// Types that can be used to index a `milf::Value` /// /// Currently this is implemented for `usize` to index arrays and `str` to index /// tables. /// /// This trait is sealed and not intended for implementation outside of the -/// `toml` crate. +/// `milf` crate. pub trait Index: Sealed { #[doc(hidden)] fn index<'a>(&self, val: &'a Value) -> Option<&'a Value>; @@ -453,7 +453,7 @@ impl<'de> de::Deserialize<'de> for Value { type Value = Value; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str("any valid TOML value") + formatter.write_str("any valid MILF value") } fn visit_bool(self, value: bool) -> Result { diff --git a/test-suite/Cargo.toml b/test-suite/Cargo.toml index 4d539c8..5122cfc 100644 --- a/test-suite/Cargo.toml +++ b/test-suite/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "toml_test_suite" +name = "milf_test_suite" version = "0.0.0" authors = ["Alex Crichton "] publish = false @@ -11,7 +11,7 @@ harness = false [dev-dependencies] bencher = "0.1" -toml = { path = ".." } +milf = { path = ".." } serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/test-suite/benches/linear.rs b/test-suite/benches/linear.rs index 1553595..5ba8174 100644 --- a/test-suite/benches/linear.rs +++ b/test-suite/benches/linear.rs @@ -1,7 +1,7 @@ // Regressoion test for https://github.com/alexcrichton/toml-rs/issues/342 use bencher::{benchmark_group, benchmark_main, black_box, Bencher}; -use toml::Value; +use milf::Value; fn parse(bench: &mut Bencher, entries: usize, f: impl Fn(usize) -> String) { let mut s = String::new(); diff --git a/test-suite/tests/backcompat.rs b/test-suite/tests/backcompat.rs index ef3bd36..7d4fcee 100644 --- a/test-suite/tests/backcompat.rs +++ b/test-suite/tests/backcompat.rs @@ -1,11 +1,11 @@ extern crate serde; -extern crate toml; +extern crate milf; use serde::de::Deserialize; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::() { + ($milf:expr, $msg:expr) => { + match $milf.parse::() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -23,9 +23,9 @@ fn newlines_after_tables() { "expected newline, found an identifier at line 2 column 13" ); - let mut d = toml::de::Deserializer::new(s); + let mut d = milf::de::Deserializer::new(s); d.set_require_newline_after_table(false); - let value = toml::Value::deserialize(&mut d).unwrap(); + let value = milf::Value::deserialize(&mut d).unwrap(); assert_eq!(value["a"]["foo"].as_integer(), Some(1)); assert_eq!(value["b"][0]["foo"].as_integer(), Some(1)); } @@ -47,9 +47,9 @@ fn allow_duplicate_after_longer() { "redefinition of table `dependencies` for key `dependencies` at line 8 column 9" ); - let mut d = toml::de::Deserializer::new(s); + let mut d = milf::de::Deserializer::new(s); d.set_allow_duplicate_after_longer_table(true); - let value = toml::Value::deserialize(&mut d).unwrap(); + let value = milf::Value::deserialize(&mut d).unwrap(); assert_eq!( value["dependencies"]["openssl-sys"]["version"].as_integer(), Some(1) diff --git a/test-suite/tests/datetime.rs b/test-suite/tests/datetime.rs index 6c08748..729591e 100644 --- a/test-suite/tests/datetime.rs +++ b/test-suite/tests/datetime.rs @@ -1,10 +1,10 @@ -extern crate toml; +extern crate milf; use std::str::FromStr; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::() { + ($milf:expr, $msg:expr) => { + match $milf.parse::() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -15,7 +15,7 @@ macro_rules! bad { fn times() { fn dogood(s: &str, serialized: &str) { let to_parse = format!("foo = {}", s); - let value = toml::Value::from_str(&to_parse).unwrap(); + let value = milf::Value::from_str(&to_parse).unwrap(); assert_eq!(value["foo"].as_datetime().unwrap().to_string(), serialized); } fn good(s: &str) { @@ -68,15 +68,15 @@ fn bad_times() { ); bad!( "foo = T", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = T.", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = TZ", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = 1997-09-09T09:09:09.09+", diff --git a/test-suite/tests/de-errors.rs b/test-suite/tests/de-errors.rs index 7666489..656dd49 100644 --- a/test-suite/tests/de-errors.rs +++ b/test-suite/tests/de-errors.rs @@ -1,12 +1,12 @@ extern crate serde; -extern crate toml; +extern crate milf; use serde::{de, Deserialize}; use std::fmt; macro_rules! bad { - ($toml:expr, $ty:ty, $msg:expr) => { - match toml::from_str::<$ty>($toml) { + ($milf:expr, $ty:ty, $msg:expr) => { + match milf::from_str::<$ty>($milf) { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -71,7 +71,7 @@ impl<'de> de::Deserialize<'de> for CasedString { #[test] fn custom_errors() { - toml::from_str::>( + milf::from_str::>( " p_a = 'a' p_b = [{c_a = 'a', c_b = 'c'}] @@ -333,7 +333,7 @@ fn error_handles_crlf() { a = 1\r\n\ a = 2\r\n\ ", - toml::Value, + milf::Value, "duplicate key: `a` for key `t2` at line 3 column 1" ); @@ -345,7 +345,7 @@ fn error_handles_crlf() { a = 1\n\ a = 2\n\ ", - toml::Value, + milf::Value, "duplicate key: `a` for key `t2` at line 3 column 1" ); } diff --git a/test-suite/tests/display-tricky.rs b/test-suite/tests/display-tricky.rs index 0daa10e..631ce70 100644 --- a/test-suite/tests/display-tricky.rs +++ b/test-suite/tests/display-tricky.rs @@ -1,4 +1,4 @@ -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; @@ -26,7 +26,7 @@ pub struct Packages { #[test] fn both_ends() { - let recipe_works = toml::from_str::( + let recipe_works = milf::from_str::( r#" name = "testing" description = "example" @@ -37,9 +37,9 @@ fn both_ends() { "#, ) .unwrap(); - toml::to_string(&recipe_works).unwrap(); + milf::to_string(&recipe_works).unwrap(); - let recipe_fails = toml::from_str::( + let recipe_fails = milf::from_str::( r#" name = "testing" description = "example" @@ -51,6 +51,6 @@ fn both_ends() { ) .unwrap(); - let recipe_toml = toml::Value::try_from(recipe_fails).unwrap(); - recipe_toml.to_string(); + let recipe_milf = milf::Value::try_from(recipe_fails).unwrap(); + recipe_milf.to_string(); } diff --git a/test-suite/tests/display.rs b/test-suite/tests/display.rs index 5d9f44a..73067e6 100644 --- a/test-suite/tests/display.rs +++ b/test-suite/tests/display.rs @@ -1,7 +1,7 @@ -extern crate toml; +extern crate milf; -use toml::map::Map; -use toml::Value::{Array, Boolean, Float, Integer, String, Table}; +use milf::map::Map; +use milf::Value::{Array, Boolean, Float, Integer, String, Table}; macro_rules! map( ($($k:expr => $v:expr),*) => ({ let mut _m = Map::new(); diff --git a/test-suite/tests/float.rs b/test-suite/tests/float.rs index 66414ea..0b639dc 100644 --- a/test-suite/tests/float.rs +++ b/test-suite/tests/float.rs @@ -1,8 +1,8 @@ -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; -use toml::Value; +use milf::Value; #[rustfmt::skip] // appears to be a bug in rustfmt to make this converge... macro_rules! float_inf_tests { @@ -18,7 +18,7 @@ macro_rules! float_inf_tests { sf7: $ty, sf8: $ty, } - let inf: S = toml::from_str( + let inf: S = milf::from_str( r" # infinity sf1 = inf # positive infinity @@ -56,7 +56,7 @@ macro_rules! float_inf_tests { assert_eq!(inf.sf8, 0.0); assert!(inf.sf8.is_sign_negative()); - let s = toml::to_string(&inf).unwrap(); + let s = milf::to_string(&inf).unwrap(); assert_eq!( s, "\ @@ -71,7 +71,7 @@ sf8 = -0.0 " ); - toml::from_str::(&s).expect("roundtrip"); + milf::from_str::(&s).expect("roundtrip"); }}; } diff --git a/test-suite/tests/formatting.rs b/test-suite/tests/formatting.rs index 8e15ec2..b459d5f 100644 --- a/test-suite/tests/formatting.rs +++ b/test-suite/tests/formatting.rs @@ -1,8 +1,8 @@ #[macro_use] extern crate serde_derive; -extern crate toml; +extern crate milf; -use toml::to_string; +use milf::to_string; #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)] struct User { diff --git a/test-suite/tests/invalid-misc.rs b/test-suite/tests/invalid-misc.rs index cea0801..14fc6c3 100644 --- a/test-suite/tests/invalid-misc.rs +++ b/test-suite/tests/invalid-misc.rs @@ -1,8 +1,8 @@ -extern crate toml; +extern crate milf; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::() { + ($milf:expr, $msg:expr) => { + match $milf.parse::() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } diff --git a/test-suite/tests/invalid.rs b/test-suite/tests/invalid.rs index f04d860..119e748 100644 --- a/test-suite/tests/invalid.rs +++ b/test-suite/tests/invalid.rs @@ -1,8 +1,8 @@ -extern crate toml; +extern crate milf; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::() { + ($milf:expr, $msg:expr) => { + match $milf.parse::() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -16,211 +16,211 @@ macro_rules! test( ($name:ident, $s:expr, $msg:expr) => ( test!( datetime_malformed_no_leads, - include_str!("invalid/datetime-malformed-no-leads.toml"), + include_str!("invalid/datetime-malformed-no-leads.milf"), "failed to parse datetime for key `no-leads` at line 1 column 12" ); test!( datetime_malformed_no_secs, - include_str!("invalid/datetime-malformed-no-secs.toml"), + include_str!("invalid/datetime-malformed-no-secs.milf"), "expected a colon, found a newline at line 1 column 28" ); test!( datetime_malformed_no_t, - include_str!("invalid/datetime-malformed-no-t.toml"), + include_str!("invalid/datetime-malformed-no-t.milf"), "failed to parse datetime for key `no-t` at line 1 column 8" ); test!( datetime_malformed_with_milli, - include_str!("invalid/datetime-malformed-with-milli.toml"), + include_str!("invalid/datetime-malformed-with-milli.milf"), "failed to parse datetime for key `with-milli` at line 1 column 14" ); test!( duplicate_key_table, - include_str!("invalid/duplicate-key-table.toml"), + include_str!("invalid/duplicate-key-table.milf"), "duplicate key: `type` for key `fruit` at line 4 column 1" ); test!( duplicate_keys, - include_str!("invalid/duplicate-keys.toml"), + include_str!("invalid/duplicate-keys.milf"), "duplicate key: `dupe` at line 1 column 1" ); test!( duplicate_table, - include_str!("invalid/duplicate-table.toml"), + include_str!("invalid/duplicate-table.milf"), "redefinition of table `dependencies` for key `dependencies` at line 7 column 1" ); test!( duplicate_tables, - include_str!("invalid/duplicate-tables.toml"), + include_str!("invalid/duplicate-tables.milf"), "redefinition of table `a` for key `a` at line 2 column 1" ); test!( empty_implicit_table, - include_str!("invalid/empty-implicit-table.toml"), + include_str!("invalid/empty-implicit-table.milf"), "expected a table key, found a period at line 1 column 10" ); test!( empty_table, - include_str!("invalid/empty-table.toml"), + include_str!("invalid/empty-table.milf"), "expected a table key, found a right bracket at line 1 column 2" ); test!( float_no_leading_zero, - include_str!("invalid/float-no-leading-zero.toml"), + include_str!("invalid/float-no-leading-zero.milf"), "expected a value, found a period at line 1 column 10" ); test!( float_no_suffix, - include_str!("invalid/float-no-suffix.toml"), + include_str!("invalid/float-no-suffix.milf"), "invalid number at line 1 column 5" ); test!( float_no_trailing_digits, - include_str!("invalid/float-no-trailing-digits.toml"), + include_str!("invalid/float-no-trailing-digits.milf"), "invalid number at line 1 column 12" ); test!( key_after_array, - include_str!("invalid/key-after-array.toml"), + include_str!("invalid/key-after-array.milf"), "expected newline, found an identifier at line 1 column 14" ); test!( key_after_table, - include_str!("invalid/key-after-table.toml"), + include_str!("invalid/key-after-table.milf"), "expected newline, found an identifier at line 1 column 11" ); test!( key_empty, - include_str!("invalid/key-empty.toml"), + include_str!("invalid/key-empty.milf"), "expected a table key, found an equals at line 1 column 2" ); test!( key_hash, - include_str!("invalid/key-hash.toml"), + include_str!("invalid/key-hash.milf"), "expected an equals, found a comment at line 1 column 2" ); test!( key_newline, - include_str!("invalid/key-newline.toml"), + include_str!("invalid/key-newline.milf"), "expected an equals, found a newline at line 1 column 2" ); test!( key_open_bracket, - include_str!("invalid/key-open-bracket.toml"), + include_str!("invalid/key-open-bracket.milf"), "expected a right bracket, found an equals at line 1 column 6" ); test!( key_single_open_bracket, - include_str!("invalid/key-single-open-bracket.toml"), + include_str!("invalid/key-single-open-bracket.milf"), "expected a table key, found eof at line 1 column 2" ); test!( key_space, - include_str!("invalid/key-space.toml"), + include_str!("invalid/key-space.milf"), "expected an equals, found an identifier at line 1 column 3" ); test!( key_start_bracket, - include_str!("invalid/key-start-bracket.toml"), + include_str!("invalid/key-start-bracket.milf"), "expected a right bracket, found an equals at line 2 column 6" ); test!( key_two_equals, - include_str!("invalid/key-two-equals.toml"), + include_str!("invalid/key-two-equals.milf"), "expected a value, found an equals at line 1 column 6" ); test!( string_bad_byte_escape, - include_str!("invalid/string-bad-byte-escape.toml"), + include_str!("invalid/string-bad-byte-escape.milf"), "invalid escape character in string: `x` at line 1 column 13" ); test!( string_bad_escape, - include_str!("invalid/string-bad-escape.toml"), + include_str!("invalid/string-bad-escape.milf"), "invalid escape character in string: `a` at line 1 column 42" ); test!( string_bad_line_ending_escape, - include_str!("invalid/string-bad-line-ending-escape.toml"), + include_str!("invalid/string-bad-line-ending-escape.milf"), "invalid escape character in string: ` ` at line 2 column 79" ); test!( string_byte_escapes, - include_str!("invalid/string-byte-escapes.toml"), + include_str!("invalid/string-byte-escapes.milf"), "invalid escape character in string: `x` at line 1 column 12" ); test!( string_no_close, - include_str!("invalid/string-no-close.toml"), + include_str!("invalid/string-no-close.milf"), "newline in string found at line 1 column 42" ); test!( table_array_implicit, - include_str!("invalid/table-array-implicit.toml"), + include_str!("invalid/table-array-implicit.milf"), "table redefined as array for key `albums` at line 13 column 1" ); test!( table_array_malformed_bracket, - include_str!("invalid/table-array-malformed-bracket.toml"), + include_str!("invalid/table-array-malformed-bracket.milf"), "expected a right bracket, found a newline at line 1 column 10" ); test!( table_array_malformed_empty, - include_str!("invalid/table-array-malformed-empty.toml"), + include_str!("invalid/table-array-malformed-empty.milf"), "expected a table key, found a right bracket at line 1 column 3" ); test!( table_empty, - include_str!("invalid/table-empty.toml"), + include_str!("invalid/table-empty.milf"), "expected a table key, found a right bracket at line 1 column 2" ); test!( table_nested_brackets_close, - include_str!("invalid/table-nested-brackets-close.toml"), + include_str!("invalid/table-nested-brackets-close.milf"), "expected newline, found an identifier at line 1 column 4" ); test!( table_nested_brackets_open, - include_str!("invalid/table-nested-brackets-open.toml"), + include_str!("invalid/table-nested-brackets-open.milf"), "expected a right bracket, found a left bracket at line 1 column 3" ); test!( table_whitespace, - include_str!("invalid/table-whitespace.toml"), + include_str!("invalid/table-whitespace.milf"), "expected a right bracket, found an identifier at line 1 column 10" ); test!( table_with_pound, - include_str!("invalid/table-with-pound.toml"), + include_str!("invalid/table-with-pound.milf"), "expected a right bracket, found a comment at line 1 column 5" ); test!( text_after_array_entries, - include_str!("invalid/text-after-array-entries.toml"), - "invalid TOML value, did you mean to use a quoted string? at line 2 column 46" + include_str!("invalid/text-after-array-entries.milf"), + "invalid MILF value, did you mean to use a quoted string? at line 2 column 46" ); test!( text_after_integer, - include_str!("invalid/text-after-integer.toml"), + include_str!("invalid/text-after-integer.milf"), "expected newline, found an identifier at line 1 column 13" ); test!( text_after_string, - include_str!("invalid/text-after-string.toml"), + include_str!("invalid/text-after-string.milf"), "expected newline, found an identifier at line 1 column 41" ); test!( text_after_table, - include_str!("invalid/text-after-table.toml"), + include_str!("invalid/text-after-table.milf"), "expected newline, found an identifier at line 1 column 9" ); test!( text_before_array_separator, - include_str!("invalid/text-before-array-separator.toml"), + include_str!("invalid/text-before-array-separator.milf"), "expected a right bracket, found an identifier at line 2 column 46" ); test!( text_in_array, - include_str!("invalid/text-in-array.toml"), - "invalid TOML value, did you mean to use a quoted string? at line 3 column 3" + include_str!("invalid/text-in-array.milf"), + "invalid MILF value, did you mean to use a quoted string? at line 3 column 3" ); diff --git a/test-suite/tests/invalid/datetime-malformed-no-leads.milf b/test-suite/tests/invalid/datetime-malformed-no-leads.milf new file mode 100644 index 0000000..123f173 --- /dev/null +++ b/test-suite/tests/invalid/datetime-malformed-no-leads.milf @@ -0,0 +1 @@ +no-leads = 1987-7-05T17:45:00Z diff --git a/test-suite/tests/invalid/datetime-malformed-no-leads.toml b/test-suite/tests/invalid/datetime-malformed-no-leads.toml deleted file mode 100644 index 123f173..0000000 --- a/test-suite/tests/invalid/datetime-malformed-no-leads.toml +++ /dev/null @@ -1 +0,0 @@ -no-leads = 1987-7-05T17:45:00Z diff --git a/test-suite/tests/invalid/datetime-malformed-no-secs.milf b/test-suite/tests/invalid/datetime-malformed-no-secs.milf new file mode 100644 index 0000000..ba93900 --- /dev/null +++ b/test-suite/tests/invalid/datetime-malformed-no-secs.milf @@ -0,0 +1 @@ +no-secs = 1987-07-05T17:45Z diff --git a/test-suite/tests/invalid/datetime-malformed-no-secs.toml b/test-suite/tests/invalid/datetime-malformed-no-secs.toml deleted file mode 100644 index ba93900..0000000 --- a/test-suite/tests/invalid/datetime-malformed-no-secs.toml +++ /dev/null @@ -1 +0,0 @@ -no-secs = 1987-07-05T17:45Z diff --git a/test-suite/tests/invalid/datetime-malformed-no-t.milf b/test-suite/tests/invalid/datetime-malformed-no-t.milf new file mode 100644 index 0000000..617e3c5 --- /dev/null +++ b/test-suite/tests/invalid/datetime-malformed-no-t.milf @@ -0,0 +1 @@ +no-t = 1987-07-0517:45:00Z diff --git a/test-suite/tests/invalid/datetime-malformed-no-t.toml b/test-suite/tests/invalid/datetime-malformed-no-t.toml deleted file mode 100644 index 617e3c5..0000000 --- a/test-suite/tests/invalid/datetime-malformed-no-t.toml +++ /dev/null @@ -1 +0,0 @@ -no-t = 1987-07-0517:45:00Z diff --git a/test-suite/tests/invalid/datetime-malformed-with-milli.milf b/test-suite/tests/invalid/datetime-malformed-with-milli.milf new file mode 100644 index 0000000..eef792f --- /dev/null +++ b/test-suite/tests/invalid/datetime-malformed-with-milli.milf @@ -0,0 +1 @@ +with-milli = 1987-07-5T17:45:00.12Z diff --git a/test-suite/tests/invalid/datetime-malformed-with-milli.toml b/test-suite/tests/invalid/datetime-malformed-with-milli.toml deleted file mode 100644 index eef792f..0000000 --- a/test-suite/tests/invalid/datetime-malformed-with-milli.toml +++ /dev/null @@ -1 +0,0 @@ -with-milli = 1987-07-5T17:45:00.12Z diff --git a/test-suite/tests/invalid/duplicate-key-table.milf b/test-suite/tests/invalid/duplicate-key-table.milf new file mode 100644 index 0000000..cedf05f --- /dev/null +++ b/test-suite/tests/invalid/duplicate-key-table.milf @@ -0,0 +1,5 @@ +[fruit] +type = "apple" + +[fruit.type] +apple = "yes" diff --git a/test-suite/tests/invalid/duplicate-key-table.toml b/test-suite/tests/invalid/duplicate-key-table.toml deleted file mode 100644 index cedf05f..0000000 --- a/test-suite/tests/invalid/duplicate-key-table.toml +++ /dev/null @@ -1,5 +0,0 @@ -[fruit] -type = "apple" - -[fruit.type] -apple = "yes" diff --git a/test-suite/tests/invalid/duplicate-keys.milf b/test-suite/tests/invalid/duplicate-keys.milf new file mode 100644 index 0000000..9b5aee0 --- /dev/null +++ b/test-suite/tests/invalid/duplicate-keys.milf @@ -0,0 +1,2 @@ +dupe = false +dupe = true diff --git a/test-suite/tests/invalid/duplicate-keys.toml b/test-suite/tests/invalid/duplicate-keys.toml deleted file mode 100644 index 9b5aee0..0000000 --- a/test-suite/tests/invalid/duplicate-keys.toml +++ /dev/null @@ -1,2 +0,0 @@ -dupe = false -dupe = true diff --git a/test-suite/tests/invalid/duplicate-table.milf b/test-suite/tests/invalid/duplicate-table.milf new file mode 100644 index 0000000..5bd2571 --- /dev/null +++ b/test-suite/tests/invalid/duplicate-table.milf @@ -0,0 +1,8 @@ +[dependencies.openssl-sys] +version = "0.5.2" + +[dependencies] +libc = "0.1" + +[dependencies] +bitflags = "0.1.1" diff --git a/test-suite/tests/invalid/duplicate-table.toml b/test-suite/tests/invalid/duplicate-table.toml deleted file mode 100644 index 5bd2571..0000000 --- a/test-suite/tests/invalid/duplicate-table.toml +++ /dev/null @@ -1,8 +0,0 @@ -[dependencies.openssl-sys] -version = "0.5.2" - -[dependencies] -libc = "0.1" - -[dependencies] -bitflags = "0.1.1" diff --git a/test-suite/tests/invalid/duplicate-tables.milf b/test-suite/tests/invalid/duplicate-tables.milf new file mode 100644 index 0000000..8ddf49b --- /dev/null +++ b/test-suite/tests/invalid/duplicate-tables.milf @@ -0,0 +1,2 @@ +[a] +[a] diff --git a/test-suite/tests/invalid/duplicate-tables.toml b/test-suite/tests/invalid/duplicate-tables.toml deleted file mode 100644 index 8ddf49b..0000000 --- a/test-suite/tests/invalid/duplicate-tables.toml +++ /dev/null @@ -1,2 +0,0 @@ -[a] -[a] diff --git a/test-suite/tests/invalid/empty-implicit-table.milf b/test-suite/tests/invalid/empty-implicit-table.milf new file mode 100644 index 0000000..0cc36d0 --- /dev/null +++ b/test-suite/tests/invalid/empty-implicit-table.milf @@ -0,0 +1 @@ +[naughty..naughty] diff --git a/test-suite/tests/invalid/empty-implicit-table.toml b/test-suite/tests/invalid/empty-implicit-table.toml deleted file mode 100644 index 0cc36d0..0000000 --- a/test-suite/tests/invalid/empty-implicit-table.toml +++ /dev/null @@ -1 +0,0 @@ -[naughty..naughty] diff --git a/test-suite/tests/invalid/empty-table.milf b/test-suite/tests/invalid/empty-table.milf new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/test-suite/tests/invalid/empty-table.milf @@ -0,0 +1 @@ +[] diff --git a/test-suite/tests/invalid/empty-table.toml b/test-suite/tests/invalid/empty-table.toml deleted file mode 100644 index fe51488..0000000 --- a/test-suite/tests/invalid/empty-table.toml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/test-suite/tests/invalid/float-no-leading-zero.milf b/test-suite/tests/invalid/float-no-leading-zero.milf new file mode 100644 index 0000000..cab76bf --- /dev/null +++ b/test-suite/tests/invalid/float-no-leading-zero.milf @@ -0,0 +1,2 @@ +answer = .12345 +neganswer = -.12345 diff --git a/test-suite/tests/invalid/float-no-leading-zero.toml b/test-suite/tests/invalid/float-no-leading-zero.toml deleted file mode 100644 index cab76bf..0000000 --- a/test-suite/tests/invalid/float-no-leading-zero.toml +++ /dev/null @@ -1,2 +0,0 @@ -answer = .12345 -neganswer = -.12345 diff --git a/test-suite/tests/invalid/float-no-suffix.milf b/test-suite/tests/invalid/float-no-suffix.milf new file mode 100644 index 0000000..76106de --- /dev/null +++ b/test-suite/tests/invalid/float-no-suffix.milf @@ -0,0 +1 @@ +a = 1.2f diff --git a/test-suite/tests/invalid/float-no-suffix.toml b/test-suite/tests/invalid/float-no-suffix.toml deleted file mode 100644 index 76106de..0000000 --- a/test-suite/tests/invalid/float-no-suffix.toml +++ /dev/null @@ -1 +0,0 @@ -a = 1.2f diff --git a/test-suite/tests/invalid/float-no-trailing-digits.milf b/test-suite/tests/invalid/float-no-trailing-digits.milf new file mode 100644 index 0000000..cbff2d0 --- /dev/null +++ b/test-suite/tests/invalid/float-no-trailing-digits.milf @@ -0,0 +1,2 @@ +answer = 1. +neganswer = -1. diff --git a/test-suite/tests/invalid/float-no-trailing-digits.toml b/test-suite/tests/invalid/float-no-trailing-digits.toml deleted file mode 100644 index cbff2d0..0000000 --- a/test-suite/tests/invalid/float-no-trailing-digits.toml +++ /dev/null @@ -1,2 +0,0 @@ -answer = 1. -neganswer = -1. diff --git a/test-suite/tests/invalid/key-after-array.milf b/test-suite/tests/invalid/key-after-array.milf new file mode 100644 index 0000000..5c1a1b0 --- /dev/null +++ b/test-suite/tests/invalid/key-after-array.milf @@ -0,0 +1 @@ +[[agencies]] owner = "S Cjelli" diff --git a/test-suite/tests/invalid/key-after-array.toml b/test-suite/tests/invalid/key-after-array.toml deleted file mode 100644 index 5c1a1b0..0000000 --- a/test-suite/tests/invalid/key-after-array.toml +++ /dev/null @@ -1 +0,0 @@ -[[agencies]] owner = "S Cjelli" diff --git a/test-suite/tests/invalid/key-after-table.milf b/test-suite/tests/invalid/key-after-table.milf new file mode 100644 index 0000000..4bc8213 --- /dev/null +++ b/test-suite/tests/invalid/key-after-table.milf @@ -0,0 +1 @@ +[history] guard = "sleeping" diff --git a/test-suite/tests/invalid/key-after-table.toml b/test-suite/tests/invalid/key-after-table.toml deleted file mode 100644 index 4bc8213..0000000 --- a/test-suite/tests/invalid/key-after-table.toml +++ /dev/null @@ -1 +0,0 @@ -[history] guard = "sleeping" diff --git a/test-suite/tests/invalid/key-empty.milf b/test-suite/tests/invalid/key-empty.milf new file mode 100644 index 0000000..09f998f --- /dev/null +++ b/test-suite/tests/invalid/key-empty.milf @@ -0,0 +1 @@ + = 1 diff --git a/test-suite/tests/invalid/key-empty.toml b/test-suite/tests/invalid/key-empty.toml deleted file mode 100644 index 09f998f..0000000 --- a/test-suite/tests/invalid/key-empty.toml +++ /dev/null @@ -1 +0,0 @@ - = 1 diff --git a/test-suite/tests/invalid/key-hash.milf b/test-suite/tests/invalid/key-hash.milf new file mode 100644 index 0000000..e321b1f --- /dev/null +++ b/test-suite/tests/invalid/key-hash.milf @@ -0,0 +1 @@ +a# = 1 diff --git a/test-suite/tests/invalid/key-hash.toml b/test-suite/tests/invalid/key-hash.toml deleted file mode 100644 index e321b1f..0000000 --- a/test-suite/tests/invalid/key-hash.toml +++ /dev/null @@ -1 +0,0 @@ -a# = 1 diff --git a/test-suite/tests/invalid/key-newline.milf b/test-suite/tests/invalid/key-newline.milf new file mode 100644 index 0000000..707aad5 --- /dev/null +++ b/test-suite/tests/invalid/key-newline.milf @@ -0,0 +1,2 @@ +a += 1 diff --git a/test-suite/tests/invalid/key-newline.toml b/test-suite/tests/invalid/key-newline.toml deleted file mode 100644 index 707aad5..0000000 --- a/test-suite/tests/invalid/key-newline.toml +++ /dev/null @@ -1,2 +0,0 @@ -a -= 1 diff --git a/test-suite/tests/invalid/key-open-bracket.milf b/test-suite/tests/invalid/key-open-bracket.milf new file mode 100644 index 0000000..f0aeb16 --- /dev/null +++ b/test-suite/tests/invalid/key-open-bracket.milf @@ -0,0 +1 @@ +[abc = 1 diff --git a/test-suite/tests/invalid/key-open-bracket.toml b/test-suite/tests/invalid/key-open-bracket.toml deleted file mode 100644 index f0aeb16..0000000 --- a/test-suite/tests/invalid/key-open-bracket.toml +++ /dev/null @@ -1 +0,0 @@ -[abc = 1 diff --git a/test-suite/tests/invalid/key-single-open-bracket.milf b/test-suite/tests/invalid/key-single-open-bracket.milf new file mode 100644 index 0000000..8e2f0be --- /dev/null +++ b/test-suite/tests/invalid/key-single-open-bracket.milf @@ -0,0 +1 @@ +[ \ No newline at end of file diff --git a/test-suite/tests/invalid/key-single-open-bracket.toml b/test-suite/tests/invalid/key-single-open-bracket.toml deleted file mode 100644 index 8e2f0be..0000000 --- a/test-suite/tests/invalid/key-single-open-bracket.toml +++ /dev/null @@ -1 +0,0 @@ -[ \ No newline at end of file diff --git a/test-suite/tests/invalid/key-space.milf b/test-suite/tests/invalid/key-space.milf new file mode 100644 index 0000000..201806d --- /dev/null +++ b/test-suite/tests/invalid/key-space.milf @@ -0,0 +1 @@ +a b = 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 deleted file mode 100644 index 201806d..0000000 --- a/test-suite/tests/invalid/key-space.toml +++ /dev/null @@ -1 +0,0 @@ -a b = 1 \ No newline at end of file diff --git a/test-suite/tests/invalid/key-start-bracket.milf b/test-suite/tests/invalid/key-start-bracket.milf new file mode 100644 index 0000000..e0597ae --- /dev/null +++ b/test-suite/tests/invalid/key-start-bracket.milf @@ -0,0 +1,3 @@ +[a] +[xyz = 5 +[b] diff --git a/test-suite/tests/invalid/key-start-bracket.toml b/test-suite/tests/invalid/key-start-bracket.toml deleted file mode 100644 index e0597ae..0000000 --- a/test-suite/tests/invalid/key-start-bracket.toml +++ /dev/null @@ -1,3 +0,0 @@ -[a] -[xyz = 5 -[b] diff --git a/test-suite/tests/invalid/key-two-equals.milf b/test-suite/tests/invalid/key-two-equals.milf new file mode 100644 index 0000000..25a0378 --- /dev/null +++ b/test-suite/tests/invalid/key-two-equals.milf @@ -0,0 +1 @@ +key= = 1 diff --git a/test-suite/tests/invalid/key-two-equals.toml b/test-suite/tests/invalid/key-two-equals.toml deleted file mode 100644 index 25a0378..0000000 --- a/test-suite/tests/invalid/key-two-equals.toml +++ /dev/null @@ -1 +0,0 @@ -key= = 1 diff --git a/test-suite/tests/invalid/string-bad-byte-escape.milf b/test-suite/tests/invalid/string-bad-byte-escape.milf new file mode 100644 index 0000000..4c7be59 --- /dev/null +++ b/test-suite/tests/invalid/string-bad-byte-escape.milf @@ -0,0 +1 @@ +naughty = "\xAg" diff --git a/test-suite/tests/invalid/string-bad-byte-escape.toml b/test-suite/tests/invalid/string-bad-byte-escape.toml deleted file mode 100644 index 4c7be59..0000000 --- a/test-suite/tests/invalid/string-bad-byte-escape.toml +++ /dev/null @@ -1 +0,0 @@ -naughty = "\xAg" diff --git a/test-suite/tests/invalid/string-bad-escape.milf b/test-suite/tests/invalid/string-bad-escape.milf new file mode 100644 index 0000000..60acb0c --- /dev/null +++ b/test-suite/tests/invalid/string-bad-escape.milf @@ -0,0 +1 @@ +invalid-escape = "This string has a bad \a escape character." diff --git a/test-suite/tests/invalid/string-bad-escape.toml b/test-suite/tests/invalid/string-bad-escape.toml deleted file mode 100644 index 60acb0c..0000000 --- a/test-suite/tests/invalid/string-bad-escape.toml +++ /dev/null @@ -1 +0,0 @@ -invalid-escape = "This string has a bad \a escape character." diff --git a/test-suite/tests/invalid/string-bad-line-ending-escape.milf b/test-suite/tests/invalid/string-bad-line-ending-escape.milf new file mode 100644 index 0000000..32e2c48 --- /dev/null +++ b/test-suite/tests/invalid/string-bad-line-ending-escape.milf @@ -0,0 +1,3 @@ +invalid-escape = """\ + This string has a non whitespace-character after the line ending escape. \ a +""" diff --git a/test-suite/tests/invalid/string-bad-line-ending-escape.toml b/test-suite/tests/invalid/string-bad-line-ending-escape.toml deleted file mode 100644 index 32e2c48..0000000 --- a/test-suite/tests/invalid/string-bad-line-ending-escape.toml +++ /dev/null @@ -1,3 +0,0 @@ -invalid-escape = """\ - This string has a non whitespace-character after the line ending escape. \ a -""" diff --git a/test-suite/tests/invalid/string-byte-escapes.milf b/test-suite/tests/invalid/string-byte-escapes.milf new file mode 100644 index 0000000..e94452a --- /dev/null +++ b/test-suite/tests/invalid/string-byte-escapes.milf @@ -0,0 +1 @@ +answer = "\x33" diff --git a/test-suite/tests/invalid/string-byte-escapes.toml b/test-suite/tests/invalid/string-byte-escapes.toml deleted file mode 100644 index e94452a..0000000 --- a/test-suite/tests/invalid/string-byte-escapes.toml +++ /dev/null @@ -1 +0,0 @@ -answer = "\x33" diff --git a/test-suite/tests/invalid/string-no-close.milf b/test-suite/tests/invalid/string-no-close.milf new file mode 100644 index 0000000..0c292fc --- /dev/null +++ b/test-suite/tests/invalid/string-no-close.milf @@ -0,0 +1 @@ +no-ending-quote = "One time, at band camp diff --git a/test-suite/tests/invalid/string-no-close.toml b/test-suite/tests/invalid/string-no-close.toml deleted file mode 100644 index 0c292fc..0000000 --- a/test-suite/tests/invalid/string-no-close.toml +++ /dev/null @@ -1 +0,0 @@ -no-ending-quote = "One time, at band camp diff --git a/test-suite/tests/invalid/table-array-implicit.milf b/test-suite/tests/invalid/table-array-implicit.milf new file mode 100644 index 0000000..a0b4e0c --- /dev/null +++ b/test-suite/tests/invalid/table-array-implicit.milf @@ -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 MILF 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-implicit.toml b/test-suite/tests/invalid/table-array-implicit.toml deleted file mode 100644 index 05f2507..0000000 --- a/test-suite/tests/invalid/table-array-implicit.toml +++ /dev/null @@ -1,14 +0,0 @@ -# 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.milf b/test-suite/tests/invalid/table-array-malformed-bracket.milf new file mode 100644 index 0000000..39c73b0 --- /dev/null +++ b/test-suite/tests/invalid/table-array-malformed-bracket.milf @@ -0,0 +1,2 @@ +[[albums] +name = "Born to Run" diff --git a/test-suite/tests/invalid/table-array-malformed-bracket.toml b/test-suite/tests/invalid/table-array-malformed-bracket.toml deleted file mode 100644 index 39c73b0..0000000 --- a/test-suite/tests/invalid/table-array-malformed-bracket.toml +++ /dev/null @@ -1,2 +0,0 @@ -[[albums] -name = "Born to Run" diff --git a/test-suite/tests/invalid/table-array-malformed-empty.milf b/test-suite/tests/invalid/table-array-malformed-empty.milf new file mode 100644 index 0000000..a470ca3 --- /dev/null +++ b/test-suite/tests/invalid/table-array-malformed-empty.milf @@ -0,0 +1,2 @@ +[[]] +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 deleted file mode 100644 index a470ca3..0000000 --- a/test-suite/tests/invalid/table-array-malformed-empty.toml +++ /dev/null @@ -1,2 +0,0 @@ -[[]] -name = "Born to Run" diff --git a/test-suite/tests/invalid/table-empty.milf b/test-suite/tests/invalid/table-empty.milf new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/test-suite/tests/invalid/table-empty.milf @@ -0,0 +1 @@ +[] diff --git a/test-suite/tests/invalid/table-empty.toml b/test-suite/tests/invalid/table-empty.toml deleted file mode 100644 index fe51488..0000000 --- a/test-suite/tests/invalid/table-empty.toml +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/test-suite/tests/invalid/table-nested-brackets-close.milf b/test-suite/tests/invalid/table-nested-brackets-close.milf new file mode 100644 index 0000000..c8b5a67 --- /dev/null +++ b/test-suite/tests/invalid/table-nested-brackets-close.milf @@ -0,0 +1,2 @@ +[a]b] +zyx = 42 diff --git a/test-suite/tests/invalid/table-nested-brackets-close.toml b/test-suite/tests/invalid/table-nested-brackets-close.toml deleted file mode 100644 index c8b5a67..0000000 --- a/test-suite/tests/invalid/table-nested-brackets-close.toml +++ /dev/null @@ -1,2 +0,0 @@ -[a]b] -zyx = 42 diff --git a/test-suite/tests/invalid/table-nested-brackets-open.milf b/test-suite/tests/invalid/table-nested-brackets-open.milf new file mode 100644 index 0000000..246d7e9 --- /dev/null +++ b/test-suite/tests/invalid/table-nested-brackets-open.milf @@ -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 deleted file mode 100644 index 246d7e9..0000000 --- a/test-suite/tests/invalid/table-nested-brackets-open.toml +++ /dev/null @@ -1,2 +0,0 @@ -[a[b] -zyx = 42 diff --git a/test-suite/tests/invalid/table-whitespace.milf b/test-suite/tests/invalid/table-whitespace.milf new file mode 100644 index 0000000..79bbcb1 --- /dev/null +++ b/test-suite/tests/invalid/table-whitespace.milf @@ -0,0 +1 @@ +[invalid key] \ No newline at end of file diff --git a/test-suite/tests/invalid/table-whitespace.toml b/test-suite/tests/invalid/table-whitespace.toml deleted file mode 100644 index 79bbcb1..0000000 --- a/test-suite/tests/invalid/table-whitespace.toml +++ /dev/null @@ -1 +0,0 @@ -[invalid key] \ No newline at end of file diff --git a/test-suite/tests/invalid/table-with-pound.milf b/test-suite/tests/invalid/table-with-pound.milf new file mode 100644 index 0000000..0d8edb5 --- /dev/null +++ b/test-suite/tests/invalid/table-with-pound.milf @@ -0,0 +1,2 @@ +[key#group] +answer = 42 \ 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 deleted file mode 100644 index 0d8edb5..0000000 --- a/test-suite/tests/invalid/table-with-pound.toml +++ /dev/null @@ -1,2 +0,0 @@ -[key#group] -answer = 42 \ No newline at end of file diff --git a/test-suite/tests/invalid/text-after-array-entries.milf b/test-suite/tests/invalid/text-after-array-entries.milf new file mode 100644 index 0000000..1a72890 --- /dev/null +++ b/test-suite/tests/invalid/text-after-array-entries.milf @@ -0,0 +1,4 @@ +array = [ + "Is there life after an array separator?", No + "Entry" +] diff --git a/test-suite/tests/invalid/text-after-array-entries.toml b/test-suite/tests/invalid/text-after-array-entries.toml deleted file mode 100644 index 1a72890..0000000 --- a/test-suite/tests/invalid/text-after-array-entries.toml +++ /dev/null @@ -1,4 +0,0 @@ -array = [ - "Is there life after an array separator?", No - "Entry" -] diff --git a/test-suite/tests/invalid/text-after-integer.milf b/test-suite/tests/invalid/text-after-integer.milf new file mode 100644 index 0000000..42de7af --- /dev/null +++ b/test-suite/tests/invalid/text-after-integer.milf @@ -0,0 +1 @@ +answer = 42 the ultimate answer? diff --git a/test-suite/tests/invalid/text-after-integer.toml b/test-suite/tests/invalid/text-after-integer.toml deleted file mode 100644 index 42de7af..0000000 --- a/test-suite/tests/invalid/text-after-integer.toml +++ /dev/null @@ -1 +0,0 @@ -answer = 42 the ultimate answer? diff --git a/test-suite/tests/invalid/text-after-string.milf b/test-suite/tests/invalid/text-after-string.milf new file mode 100644 index 0000000..c92a6f1 --- /dev/null +++ b/test-suite/tests/invalid/text-after-string.milf @@ -0,0 +1 @@ +string = "Is there life after strings?" No. diff --git a/test-suite/tests/invalid/text-after-string.toml b/test-suite/tests/invalid/text-after-string.toml deleted file mode 100644 index c92a6f1..0000000 --- a/test-suite/tests/invalid/text-after-string.toml +++ /dev/null @@ -1 +0,0 @@ -string = "Is there life after strings?" No. diff --git a/test-suite/tests/invalid/text-after-table.milf b/test-suite/tests/invalid/text-after-table.milf new file mode 100644 index 0000000..87da9db --- /dev/null +++ b/test-suite/tests/invalid/text-after-table.milf @@ -0,0 +1 @@ +[error] this shouldn't be here diff --git a/test-suite/tests/invalid/text-after-table.toml b/test-suite/tests/invalid/text-after-table.toml deleted file mode 100644 index 87da9db..0000000 --- a/test-suite/tests/invalid/text-after-table.toml +++ /dev/null @@ -1 +0,0 @@ -[error] this shouldn't be here diff --git a/test-suite/tests/invalid/text-before-array-separator.milf b/test-suite/tests/invalid/text-before-array-separator.milf new file mode 100644 index 0000000..9b06a39 --- /dev/null +++ b/test-suite/tests/invalid/text-before-array-separator.milf @@ -0,0 +1,4 @@ +array = [ + "Is there life before an array separator?" No, + "Entry" +] diff --git a/test-suite/tests/invalid/text-before-array-separator.toml b/test-suite/tests/invalid/text-before-array-separator.toml deleted file mode 100644 index 9b06a39..0000000 --- a/test-suite/tests/invalid/text-before-array-separator.toml +++ /dev/null @@ -1,4 +0,0 @@ -array = [ - "Is there life before an array separator?" No, - "Entry" -] diff --git a/test-suite/tests/invalid/text-in-array.milf b/test-suite/tests/invalid/text-in-array.milf new file mode 100644 index 0000000..a6a6c42 --- /dev/null +++ b/test-suite/tests/invalid/text-in-array.milf @@ -0,0 +1,5 @@ +array = [ + "Entry 1", + I don't belong, + "Entry 2", +] diff --git a/test-suite/tests/invalid/text-in-array.toml b/test-suite/tests/invalid/text-in-array.toml deleted file mode 100644 index a6a6c42..0000000 --- a/test-suite/tests/invalid/text-in-array.toml +++ /dev/null @@ -1,5 +0,0 @@ -array = [ - "Entry 1", - I don't belong, - "Entry 2", -] diff --git a/test-suite/tests/macros.rs b/test-suite/tests/macros.rs index 20831a0..3cc5e81 100644 --- a/test-suite/tests/macros.rs +++ b/test-suite/tests/macros.rs @@ -1,7 +1,7 @@ #![recursion_limit = "256"] #[macro_use] -extern crate toml; +extern crate milf; use std::f64; @@ -9,11 +9,11 @@ macro_rules! table { ($($key:expr => $value:expr,)*) => {{ // https://github.com/rust-lang/rust/issues/60643 #[allow(unused_mut)] - let mut table = toml::value::Table::new(); + let mut table = milf::value::Table::new(); $( table.insert($key.to_string(), $value.into()); )* - toml::Value::Table(table) + milf::Value::Table(table) }}; } @@ -21,22 +21,22 @@ macro_rules! array { ($($element:expr,)*) => {{ // https://github.com/rust-lang/rust/issues/60643 #[allow(unused_mut)] - let mut array = toml::value::Array::new(); + let mut array = milf::value::Array::new(); $( array.push($element.into()); )* - toml::Value::Array(array) + milf::Value::Array(array) }}; } macro_rules! datetime { ($s:tt) => { - $s.parse::().unwrap() + $s.parse::().unwrap() }; } #[test] -fn test_cargo_toml() { +fn test_cargo_milf() { // Simple sanity check of: // // - Ordinary tables @@ -45,9 +45,9 @@ fn test_cargo_toml() { // - String values // - Table keys containing hyphen // - Table headers containing hyphen - let actual = toml! { + let actual = milf! { [package] - name = "toml" + name = "milf" version = "0.4.5" authors = ["Alex Crichton "] @@ -64,7 +64,7 @@ fn test_cargo_toml() { let expected = table! { "package" => table! { - "name" => "toml".to_owned(), + "name" => "milf".to_owned(), "version" => "0.4.5".to_owned(), "authors" => array! { "Alex Crichton ".to_owned(), @@ -89,8 +89,8 @@ fn test_cargo_toml() { #[test] fn test_array() { - // Copied from the TOML spec. - let actual = toml! { + // Copied from the MILF spec. + let actual = milf! { [[fruit]] name = "apple" @@ -144,7 +144,7 @@ fn test_array() { #[test] fn test_number() { - let actual = toml! { + let actual = milf! { positive = 1 negative = -1 table = { positive = 1, negative = -1 } @@ -193,7 +193,7 @@ fn test_number() { #[test] fn test_nan() { - let actual = toml! { + let actual = milf! { sf4 = nan sf5 = +nan sf6 = -nan @@ -205,8 +205,8 @@ fn test_nan() { #[test] fn test_datetime() { - let actual = toml! { - // Copied from the TOML spec. + let actual = milf! { + // Copied from the MILF spec. odt1 = 1979-05-27T07:32:00Z odt2 = 1979-05-27T00:32:00-07:00 odt3 = 1979-05-27T00:32:00.999999-07:00 @@ -284,7 +284,7 @@ fn test_datetime() { // This test requires rustc >= 1.20. #[test] fn test_quoted_key() { - let actual = toml! { + let actual = milf! { "quoted" = true table = { "quoted" = true } @@ -311,7 +311,7 @@ fn test_quoted_key() { #[test] fn test_empty() { - let actual = toml! { + let actual = milf! { empty_inline_table = {} empty_inline_array = [] @@ -334,7 +334,7 @@ fn test_empty() { #[test] fn test_dotted_keys() { - let actual = toml! { + let actual = milf! { a.b = 123 a.c = 1979-05-27T07:32:00Z [table] diff --git a/test-suite/tests/parser.rs b/test-suite/tests/parser.rs index 169df79..0d14803 100644 --- a/test-suite/tests/parser.rs +++ b/test-suite/tests/parser.rs @@ -1,10 +1,10 @@ -extern crate toml; +extern crate milf; -use toml::Value; +use milf::Value; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::() { + ($milf:expr, $msg:expr) => { + match $milf.parse::() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -493,7 +493,7 @@ fn bad_underscores() { bad!("foo = 0__0", "invalid number at line 1 column 7"); bad!( "foo = __0", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!("foo = 1_0_", "invalid number at line 1 column 7"); } @@ -540,19 +540,19 @@ fn booleans() { bad!( "foo = true2", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = false2", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = t1", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = f2", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); } @@ -643,8 +643,8 @@ fn datetimes() { macro_rules! t { ($actual:expr) => {{ let f = format!("foo = {}", $actual); - let toml = f.parse::().expect(&format!("failed: {}", f)); - assert_eq!(toml["foo"].as_datetime().unwrap().to_string(), $actual); + let milf = f.parse::().expect(&format!("failed: {}", f)); + assert_eq!(milf["foo"].as_datetime().unwrap().to_string(), $actual); }}; } diff --git a/test-suite/tests/pretty.rs b/test-suite/tests/pretty.rs index 0c65e0f..ee9f4f8 100644 --- a/test-suite/tests/pretty.rs +++ b/test-suite/tests/pretty.rs @@ -1,5 +1,5 @@ extern crate serde; -extern crate toml; +extern crate milf; use serde::ser::Serialize; @@ -13,31 +13,31 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] fn no_pretty() { - let toml = NO_PRETTY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = NO_PRETTY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::new(&mut result)) + .serialize(&mut milf::Serializer::new(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } #[test] fn disable_pretty() { - let toml = NO_PRETTY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = NO_PRETTY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); serializer.pretty_array(false); value.serialize(&mut serializer).unwrap(); } - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_STD: &'static str = "\ @@ -57,15 +57,15 @@ this is the second line #[test] fn pretty_std() { - let toml = PRETTY_STD; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_STD; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_INDENT_2: &'static str = "\ @@ -90,16 +90,16 @@ three = [ #[test] fn pretty_indent_2() { - let toml = PRETTY_INDENT_2; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_INDENT_2; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_array_indent(2); value.serialize(&mut serializer).unwrap(); } println!(">> Result:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_INDENT_2_OTHER: &'static str = "\ @@ -116,15 +116,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_indent_2_other() { - let toml = PRETTY_INDENT_2_OTHER; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_INDENT_2_OTHER; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_indent(2); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_ARRAY_NO_COMMA: &'static str = "\ @@ -140,15 +140,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_indent_array_no_comma() { - let toml = PRETTY_ARRAY_NO_COMMA; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_ARRAY_NO_COMMA; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_trailing_comma(false); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_NO_STRING: &'static str = "\ @@ -164,15 +164,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_no_string() { - let toml = PRETTY_NO_STRING; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_NO_STRING; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TRICKY: &'static str = r##"[example] @@ -204,15 +204,15 @@ this is the fourth line #[test] fn pretty_tricky() { - let toml = PRETTY_TRICKY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TRICKY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TABLE_ARRAY: &'static str = r##"[[array]] @@ -230,15 +230,15 @@ single = 'this is a single line string' #[test] fn pretty_table_array() { - let toml = PRETTY_TABLE_ARRAY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TABLE_ARRAY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const TABLE_ARRAY: &'static str = r##"[[array]] @@ -256,15 +256,15 @@ single = "this is a single line string" #[test] fn table_array() { - let toml = TABLE_ARRAY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = TABLE_ARRAY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::new(&mut result)) + .serialize(&mut milf::Serializer::new(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TRICKY_NON_LITERAL: &'static str = r##"[example] @@ -300,15 +300,15 @@ this is the fourth line #[test] fn pretty_tricky_non_literal() { - let toml = PRETTY_TRICKY_NON_LITERAL; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TRICKY_NON_LITERAL; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string_literal(false); value.serialize(&mut serializer).unwrap(); } - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } diff --git a/test-suite/tests/serde.rs b/test-suite/tests/serde.rs index 56172bd..712d2c5 100644 --- a/test-suite/tests/serde.rs +++ b/test-suite/tests/serde.rs @@ -1,15 +1,15 @@ extern crate serde; extern crate serde_json; -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; use serde::{Deserialize, Deserializer}; use std::collections::{BTreeMap, HashSet}; -use toml::map::Map; -use toml::Value; -use toml::Value::{Array, Float, Integer, Table}; +use milf::map::Map; +use milf::Value; +use milf::Value::{Array, Float, Integer, Table}; macro_rules! t { ($e:expr) => { @@ -21,38 +21,38 @@ macro_rules! t { } macro_rules! equivalent { - ($literal:expr, $toml:expr,) => {{ - let toml = $toml; + ($literal:expr, $milf:expr,) => {{ + let milf = $milf; let literal = $literal; // In/out of Value is equivalent println!("try_from"); - assert_eq!(t!(Value::try_from(literal.clone())), toml); + assert_eq!(t!(Value::try_from(literal.clone())), milf); println!("try_into"); - assert_eq!(literal, t!(toml.clone().try_into())); + assert_eq!(literal, t!(milf.clone().try_into())); // Through a string equivalent println!("to_string(literal)"); - assert_eq!(t!(toml::to_string(&literal)), toml.to_string()); - println!("to_string(toml)"); - assert_eq!(t!(toml::to_string(&toml)), toml.to_string()); - println!("literal, from_str(toml)"); - assert_eq!(literal, t!(toml::from_str(&toml.to_string()))); - println!("toml, from_str(toml)"); - assert_eq!(toml, t!(toml::from_str(&toml.to_string()))); + assert_eq!(t!(milf::to_string(&literal)), milf.to_string()); + println!("to_string(milf)"); + assert_eq!(t!(milf::to_string(&milf)), milf.to_string()); + println!("literal, from_str(milf)"); + assert_eq!(literal, t!(milf::from_str(&milf.to_string()))); + println!("milf, from_str(milf)"); + assert_eq!(milf, t!(milf::from_str(&milf.to_string()))); }}; } macro_rules! error { - ($ty:ty, $toml:expr, $msg_parse:expr, $msg_decode:expr) => {{ + ($ty:ty, $milf:expr, $msg_parse:expr, $msg_decode:expr) => {{ println!("attempting parsing"); - match toml::from_str::<$ty>(&$toml.to_string()) { + match milf::from_str::<$ty>(&$milf.to_string()) { Ok(_) => panic!("successful"), Err(e) => assert_eq!(e.to_string(), $msg_parse), } - println!("attempting toml decoding"); - match $toml.try_into::<$ty>() { + println!("attempting milf decoding"); + match $milf.try_into::<$ty>() { Ok(_) => panic!("successful"), Err(e) => assert_eq!(e.to_string(), $msg_decode), } @@ -376,7 +376,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, Some(Table(map! { +// assert_eq!(d.milf, Some(Table(map! { // b, Integer(5) // }))); // } @@ -397,7 +397,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, Some(Table(map! { +// assert_eq!(d.milf, Some(Table(map! { // a, Table(map! { // b, Integer(5) // }) @@ -419,7 +419,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -435,7 +435,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -449,7 +449,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -463,7 +463,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -482,7 +482,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, Some(Table(map! { +// assert_eq!(d.milf, Some(Table(map! { // a, Array(vec![Table(map! { // b, Integer(2) // })]) @@ -531,9 +531,9 @@ fn extra_keys() { a: isize, } - let toml = Table(map! { a: Integer(2), b: Integer(2) }); - assert!(toml.clone().try_into::().is_ok()); - assert!(toml::from_str::(&toml.to_string()).is_ok()); + let milf = Table(map! { a: Integer(2), b: Integer(2) }); + assert!(milf.clone().try_into::().is_ok()); + assert!(milf::from_str::(&milf.to_string()).is_ok()); } #[test] @@ -590,7 +590,7 @@ struct CanBeEmpty { #[test] fn table_structs_empty() { let text = "[bar]\n\n[baz]\n\n[bazv]\na = \"foo\"\n\n[foo]\n"; - let value: BTreeMap = toml::from_str(text).unwrap(); + let value: BTreeMap = milf::from_str(text).unwrap(); let mut expected: BTreeMap = BTreeMap::new(); expected.insert("bar".to_string(), CanBeEmpty::default()); expected.insert("baz".to_string(), CanBeEmpty::default()); @@ -603,7 +603,7 @@ fn table_structs_empty() { ); expected.insert("foo".to_string(), CanBeEmpty::default()); assert_eq!(value, expected); - assert_eq!(toml::to_string(&value).unwrap(), text); + assert_eq!(milf::to_string(&value).unwrap(), text); } #[test] @@ -671,7 +671,7 @@ fn homogeneous_tuple_struct() { fn json_interoperability() { #[derive(Serialize, Deserialize)] struct Foo { - any: toml::Value, + any: milf::Value, } let _foo: Foo = serde_json::from_str( diff --git a/test-suite/tests/spanned-impls.rs b/test-suite/tests/spanned-impls.rs index cb12b1a..eb95673 100644 --- a/test-suite/tests/spanned-impls.rs +++ b/test-suite/tests/spanned-impls.rs @@ -1,5 +1,5 @@ use std::cmp::{Ord, Ordering, PartialOrd}; -use toml::{from_str, Spanned}; +use milf::{from_str, Spanned}; #[macro_use] extern crate serde_derive; diff --git a/test-suite/tests/spanned.rs b/test-suite/tests/spanned.rs index d8f7a12..a8d29d4 100644 --- a/test-suite/tests/spanned.rs +++ b/test-suite/tests/spanned.rs @@ -1,12 +1,12 @@ extern crate serde; -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; use std::collections::HashMap; use std::fmt::Debug; -use toml::value::Datetime; -use toml::Spanned; +use milf::value::Datetime; +use milf::Spanned; /// A set of good datetimes. pub fn good_datetimes() -> Vec<&'static str> { @@ -41,7 +41,7 @@ fn test_spanned_field() { where T: serde::Deserialize<'de> + Debug + PartialEq, { - let foo: Foo = toml::from_str(s).unwrap(); + let foo: Foo = milf::from_str(s).unwrap(); assert_eq!(6, foo.foo.start()); if let Some(end) = end { @@ -52,7 +52,7 @@ fn test_spanned_field() { assert_eq!(expected, &s[foo.foo.start()..foo.foo.end()]); // Test for Spanned<> at the top level - let foo_outer: Spanned> = toml::from_str(s).unwrap(); + let foo_outer: Spanned> = milf::from_str(s).unwrap(); assert_eq!(0, foo_outer.start()); assert_eq!(s.len(), foo_outer.end()); @@ -94,13 +94,13 @@ fn test_inner_spanned_table() { } fn good(s: &str, zero: bool) { - let foo: Foo = toml::from_str(s).unwrap(); + let foo: Foo = milf::from_str(s).unwrap(); if zero { assert_eq!(foo.foo.start(), 0); // We'd actually have to assert equality with s.len() here, // but the current implementation doesn't support that, - // and it's not possible with toml's data format to support it + // and it's not possible with milf's data format to support it // in the general case as spans aren't always well-defined. // So this check mainly serves as a reminder that this test should // be updated *if* one day there is support for emitting the actual span. @@ -141,7 +141,7 @@ fn test_outer_spanned_table() { } fn good(s: &str) { - let foo: Foo = toml::from_str(s).unwrap(); + let foo: Foo = milf::from_str(s).unwrap(); for (k, v) in foo.foo.iter() { assert_eq!(&s[k.start()..k.end()], k.get_ref()); @@ -174,7 +174,7 @@ fn test_spanned_nested() { } fn good(s: &str) { - let foo: Foo = toml::from_str(s).unwrap(); + let foo: Foo = milf::from_str(s).unwrap(); for (k, v) in foo.foo.iter() { assert_eq!(&s[k.start()..k.end()], k.get_ref()); @@ -214,13 +214,13 @@ fn test_spanned_array() { } fn good(s: &str) { - let foo_list: Foo = toml::from_str(s).unwrap(); + let foo_list: Foo = milf::from_str(s).unwrap(); for foo in foo_list.foo.iter() { assert_eq!(foo.start(), 0); // We'd actually have to assert equality with s.len() here, // but the current implementation doesn't support that, - // and it's not possible with toml's data format to support it + // and it's not possible with milf's data format to support it // in the general case as spans aren't always well-defined. // So this check mainly serves as a reminder that this test should // be updated *if* one day there is support for emitting the actual span. diff --git a/test-suite/tests/tables-last.rs b/test-suite/tests/tables-last.rs index b885a42..ae427e4 100644 --- a/test-suite/tests/tables-last.rs +++ b/test-suite/tests/tables-last.rs @@ -1,12 +1,12 @@ #[macro_use] extern crate serde_derive; -extern crate toml; +extern crate milf; use std::collections::HashMap; #[derive(Serialize)] struct A { - #[serde(serialize_with = "toml::ser::tables_last")] + #[serde(serialize_with = "milf::ser::tables_last")] vals: HashMap<&'static str, Value>, } @@ -28,5 +28,5 @@ fn always_works() { sub.insert("foo", "bar"); a.vals.insert("bar", Value::Map(sub)); - toml::to_string(&a).unwrap(); + milf::to_string(&a).unwrap(); } diff --git a/test-suite/tests/valid.rs b/test-suite/tests/valid.rs index 0745cc8..ddbaf1b 100644 --- a/test-suite/tests/valid.rs +++ b/test-suite/tests/valid.rs @@ -1,12 +1,12 @@ extern crate serde; extern crate serde_json; -extern crate toml; +extern crate milf; use serde::ser::Serialize; use serde_json::Value as Json; -use toml::{to_string_pretty, Value as Toml}; +use milf::{to_string_pretty, Value as Milf}; -fn to_json(toml: toml::Value) -> Json { +fn to_json(milf: milf::Value) -> Json { fn doit(s: &str, json: Json) -> Json { let mut map = serde_json::Map::new(); map.insert("type".to_string(), Json::String(s.to_string())); @@ -14,10 +14,10 @@ fn to_json(toml: toml::Value) -> Json { Json::Object(map) } - match toml { - Toml::String(s) => doit("string", Json::String(s)), - Toml::Integer(i) => doit("integer", Json::String(i.to_string())), - Toml::Float(f) => doit( + match milf { + Milf::String(s) => doit("string", Json::String(s)), + Milf::Integer(i) => doit("integer", Json::String(i.to_string())), + Milf::Float(f) => doit( "float", Json::String({ let s = format!("{:.15}", f); @@ -29,11 +29,11 @@ fn to_json(toml: toml::Value) -> Json { } }), ), - Toml::Boolean(b) => doit("bool", Json::String(format!("{}", b))), - Toml::Datetime(s) => doit("datetime", Json::String(s.to_string())), - Toml::Array(arr) => { + Milf::Boolean(b) => doit("bool", Json::String(format!("{}", b))), + Milf::Datetime(s) => doit("datetime", Json::String(s.to_string())), + Milf::Array(arr) => { let is_table = match arr.first() { - Some(&Toml::Table(..)) => true, + Some(&Milf::Table(..)) => true, _ => false, }; let json = Json::Array(arr.into_iter().map(to_json).collect()); @@ -43,7 +43,7 @@ fn to_json(toml: toml::Value) -> Json { doit("array", json) } } - Toml::Table(table) => { + Milf::Table(table) => { let mut map = serde_json::Map::new(); for (k, v) in table { map.insert(k, to_json(v)); @@ -53,345 +53,345 @@ fn to_json(toml: toml::Value) -> Json { } } -fn run_pretty(toml: Toml) { - // Assert toml == json +fn run_pretty(milf: Milf) { + // Assert milf == json println!("### pretty round trip parse."); // standard pretty - let toml_raw = to_string_pretty(&toml).expect("to string"); - let toml2 = toml_raw.parse().expect("from string"); - assert_eq!(toml, toml2); + let milf_raw = to_string_pretty(&milf).expect("to string"); + let milf2 = milf_raw.parse().expect("from string"); + assert_eq!(milf, milf2); // pretty with indent 2 let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_array_indent(2); - toml.serialize(&mut serializer).expect("to string"); + milf.serialize(&mut serializer).expect("to string"); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); result.clear(); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_trailing_comma(false); - toml.serialize(&mut serializer).expect("to string"); + milf.serialize(&mut serializer).expect("to string"); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); result.clear(); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); - toml.serialize(&mut serializer).expect("to string"); - assert_eq!(toml, toml2); + milf.serialize(&mut serializer).expect("to string"); + assert_eq!(milf, milf2); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); result.clear(); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_array(false); - toml.serialize(&mut serializer).expect("to string"); - assert_eq!(toml, toml2); + milf.serialize(&mut serializer).expect("to string"); + assert_eq!(milf, milf2); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); } -fn run(toml_raw: &str, json_raw: &str) { - println!("parsing:\n{}", toml_raw); - let toml: Toml = toml_raw.parse().unwrap(); +fn run(milf_raw: &str, json_raw: &str) { + println!("parsing:\n{}", milf_raw); + let milf: Milf = milf_raw.parse().unwrap(); let json: Json = json_raw.parse().unwrap(); - // Assert toml == json - let toml_json = to_json(toml.clone()); + // Assert milf == json + let milf_json = to_json(milf.clone()); assert!( - json == toml_json, + json == milf_json, "expected\n{}\ngot\n{}\n", serde_json::to_string_pretty(&json).unwrap(), - serde_json::to_string_pretty(&toml_json).unwrap() + serde_json::to_string_pretty(&milf_json).unwrap() ); // Assert round trip - println!("round trip parse: {}", toml); - let toml2 = toml.to_string().parse().unwrap(); - assert_eq!(toml, toml2); - run_pretty(toml); + println!("round trip parse: {}", milf); + let milf2 = milf.to_string().parse().unwrap(); + assert_eq!(milf, milf2); + run_pretty(milf); } -macro_rules! test( ($name:ident, $toml:expr, $json:expr) => ( +macro_rules! test( ($name:ident, $milf:expr, $json:expr) => ( #[test] - fn $name() { run($toml, $json); } + fn $name() { run($milf, $json); } ) ); test!( array_empty, - include_str!("valid/array-empty.toml"), + include_str!("valid/array-empty.milf"), include_str!("valid/array-empty.json") ); test!( array_nospaces, - include_str!("valid/array-nospaces.toml"), + include_str!("valid/array-nospaces.milf"), include_str!("valid/array-nospaces.json") ); test!( arrays_hetergeneous, - include_str!("valid/arrays-hetergeneous.toml"), + include_str!("valid/arrays-hetergeneous.milf"), include_str!("valid/arrays-hetergeneous.json") ); test!( arrays, - include_str!("valid/arrays.toml"), + include_str!("valid/arrays.milf"), include_str!("valid/arrays.json") ); test!( arrays_nested, - include_str!("valid/arrays-nested.toml"), + include_str!("valid/arrays-nested.milf"), include_str!("valid/arrays-nested.json") ); test!( array_mixed_types_ints_and_floats, - include_str!("valid/array-mixed-types-ints-and-floats.toml"), + include_str!("valid/array-mixed-types-ints-and-floats.milf"), include_str!("valid/array-mixed-types-ints-and-floats.json") ); test!( array_mixed_types_arrays_and_ints, - include_str!("valid/array-mixed-types-arrays-and-ints.toml"), + include_str!("valid/array-mixed-types-arrays-and-ints.milf"), include_str!("valid/array-mixed-types-arrays-and-ints.json") ); test!( array_mixed_types_strings_and_ints, - include_str!("valid/array-mixed-types-strings-and-ints.toml"), + include_str!("valid/array-mixed-types-strings-and-ints.milf"), include_str!("valid/array-mixed-types-strings-and-ints.json") ); test!( empty, - include_str!("valid/empty.toml"), + include_str!("valid/empty.milf"), include_str!("valid/empty.json") ); test!( bool, - include_str!("valid/bool.toml"), + include_str!("valid/bool.milf"), include_str!("valid/bool.json") ); test!( comments_everywhere, - include_str!("valid/comments-everywhere.toml"), + include_str!("valid/comments-everywhere.milf"), include_str!("valid/comments-everywhere.json") ); test!( datetime, - include_str!("valid/datetime.toml"), + include_str!("valid/datetime.milf"), include_str!("valid/datetime.json") ); test!( example, - include_str!("valid/example.toml"), + include_str!("valid/example.milf"), include_str!("valid/example.json") ); test!( float, - include_str!("valid/float.toml"), + include_str!("valid/float.milf"), include_str!("valid/float.json") ); test!( implicit_and_explicit_after, - include_str!("valid/implicit-and-explicit-after.toml"), + include_str!("valid/implicit-and-explicit-after.milf"), include_str!("valid/implicit-and-explicit-after.json") ); test!( implicit_and_explicit_before, - include_str!("valid/implicit-and-explicit-before.toml"), + include_str!("valid/implicit-and-explicit-before.milf"), include_str!("valid/implicit-and-explicit-before.json") ); test!( implicit_groups, - include_str!("valid/implicit-groups.toml"), + include_str!("valid/implicit-groups.milf"), include_str!("valid/implicit-groups.json") ); test!( integer, - include_str!("valid/integer.toml"), + include_str!("valid/integer.milf"), include_str!("valid/integer.json") ); test!( key_equals_nospace, - include_str!("valid/key-equals-nospace.toml"), + include_str!("valid/key-equals-nospace.milf"), include_str!("valid/key-equals-nospace.json") ); test!( key_space, - include_str!("valid/key-space.toml"), + include_str!("valid/key-space.milf"), include_str!("valid/key-space.json") ); test!( key_special_chars, - include_str!("valid/key-special-chars.toml"), + include_str!("valid/key-special-chars.milf"), include_str!("valid/key-special-chars.json") ); test!( key_with_pound, - include_str!("valid/key-with-pound.toml"), + include_str!("valid/key-with-pound.milf"), include_str!("valid/key-with-pound.json") ); test!( long_float, - include_str!("valid/long-float.toml"), + include_str!("valid/long-float.milf"), include_str!("valid/long-float.json") ); test!( long_integer, - include_str!("valid/long-integer.toml"), + include_str!("valid/long-integer.milf"), include_str!("valid/long-integer.json") ); test!( multiline_string, - include_str!("valid/multiline-string.toml"), + include_str!("valid/multiline-string.milf"), include_str!("valid/multiline-string.json") ); test!( raw_multiline_string, - include_str!("valid/raw-multiline-string.toml"), + include_str!("valid/raw-multiline-string.milf"), include_str!("valid/raw-multiline-string.json") ); test!( raw_string, - include_str!("valid/raw-string.toml"), + include_str!("valid/raw-string.milf"), include_str!("valid/raw-string.json") ); test!( string_empty, - include_str!("valid/string-empty.toml"), + include_str!("valid/string-empty.milf"), include_str!("valid/string-empty.json") ); test!( string_escapes, - include_str!("valid/string-escapes.toml"), + include_str!("valid/string-escapes.milf"), include_str!("valid/string-escapes.json") ); test!( string_simple, - include_str!("valid/string-simple.toml"), + include_str!("valid/string-simple.milf"), include_str!("valid/string-simple.json") ); test!( string_with_pound, - include_str!("valid/string-with-pound.toml"), + include_str!("valid/string-with-pound.milf"), include_str!("valid/string-with-pound.json") ); test!( table_array_implicit, - include_str!("valid/table-array-implicit.toml"), + include_str!("valid/table-array-implicit.milf"), include_str!("valid/table-array-implicit.json") ); test!( table_array_many, - include_str!("valid/table-array-many.toml"), + include_str!("valid/table-array-many.milf"), include_str!("valid/table-array-many.json") ); test!( table_array_nest, - include_str!("valid/table-array-nest.toml"), + include_str!("valid/table-array-nest.milf"), include_str!("valid/table-array-nest.json") ); test!( table_array_one, - include_str!("valid/table-array-one.toml"), + include_str!("valid/table-array-one.milf"), include_str!("valid/table-array-one.json") ); test!( table_empty, - include_str!("valid/table-empty.toml"), + include_str!("valid/table-empty.milf"), include_str!("valid/table-empty.json") ); test!( table_sub_empty, - include_str!("valid/table-sub-empty.toml"), + include_str!("valid/table-sub-empty.milf"), include_str!("valid/table-sub-empty.json") ); test!( table_multi_empty, - include_str!("valid/table-multi-empty.toml"), + include_str!("valid/table-multi-empty.milf"), include_str!("valid/table-multi-empty.json") ); test!( table_whitespace, - include_str!("valid/table-whitespace.toml"), + include_str!("valid/table-whitespace.milf"), include_str!("valid/table-whitespace.json") ); test!( table_with_pound, - include_str!("valid/table-with-pound.toml"), + include_str!("valid/table-with-pound.milf"), include_str!("valid/table-with-pound.json") ); test!( unicode_escape, - include_str!("valid/unicode-escape.toml"), + include_str!("valid/unicode-escape.milf"), include_str!("valid/unicode-escape.json") ); test!( unicode_literal, - include_str!("valid/unicode-literal.toml"), + include_str!("valid/unicode-literal.milf"), include_str!("valid/unicode-literal.json") ); test!( hard_example, - include_str!("valid/hard_example.toml"), + include_str!("valid/hard_example.milf"), include_str!("valid/hard_example.json") ); test!( example2, - include_str!("valid/example2.toml"), + include_str!("valid/example2.milf"), include_str!("valid/example2.json") ); test!( example3, - include_str!("valid/example-v0.3.0.toml"), + include_str!("valid/example-v0.3.0.milf"), include_str!("valid/example-v0.3.0.json") ); test!( example4, - include_str!("valid/example-v0.4.0.toml"), + include_str!("valid/example-v0.4.0.milf"), include_str!("valid/example-v0.4.0.json") ); test!( example_bom, - include_str!("valid/example-bom.toml"), + include_str!("valid/example-bom.milf"), include_str!("valid/example.json") ); test!( datetime_truncate, - include_str!("valid/datetime-truncate.toml"), + include_str!("valid/datetime-truncate.milf"), include_str!("valid/datetime-truncate.json") ); test!( key_quote_newline, - include_str!("valid/key-quote-newline.toml"), + include_str!("valid/key-quote-newline.milf"), include_str!("valid/key-quote-newline.json") ); test!( table_array_nest_no_keys, - include_str!("valid/table-array-nest-no-keys.toml"), + include_str!("valid/table-array-nest-no-keys.milf"), include_str!("valid/table-array-nest-no-keys.json") ); test!( dotted_keys, - include_str!("valid/dotted-keys.toml"), + include_str!("valid/dotted-keys.milf"), include_str!("valid/dotted-keys.json") ); test!( quote_surrounded_value, - include_str!("valid/quote-surrounded-value.toml"), + include_str!("valid/quote-surrounded-value.milf"), include_str!("valid/quote-surrounded-value.json") ); test!( float_exponent, - include_str!("valid/float-exponent.toml"), + include_str!("valid/float-exponent.milf"), include_str!("valid/float-exponent.json") ); test!( string_delim_end, - include_str!("valid/string-delim-end.toml"), + include_str!("valid/string-delim-end.milf"), include_str!("valid/string-delim-end.json") ); diff --git a/test-suite/tests/valid/array-empty.milf b/test-suite/tests/valid/array-empty.milf new file mode 100644 index 0000000..fa58dc6 --- /dev/null +++ b/test-suite/tests/valid/array-empty.milf @@ -0,0 +1 @@ +thevoid = [[[[[]]]]] diff --git a/test-suite/tests/valid/array-empty.toml b/test-suite/tests/valid/array-empty.toml deleted file mode 100644 index fa58dc6..0000000 --- a/test-suite/tests/valid/array-empty.toml +++ /dev/null @@ -1 +0,0 @@ -thevoid = [[[[[]]]]] diff --git a/test-suite/tests/valid/array-mixed-types-arrays-and-ints.milf b/test-suite/tests/valid/array-mixed-types-arrays-and-ints.milf new file mode 100644 index 0000000..051ec73 --- /dev/null +++ b/test-suite/tests/valid/array-mixed-types-arrays-and-ints.milf @@ -0,0 +1 @@ +arrays-and-ints = [1, ["Arrays are not integers."]] diff --git a/test-suite/tests/valid/array-mixed-types-arrays-and-ints.toml b/test-suite/tests/valid/array-mixed-types-arrays-and-ints.toml deleted file mode 100644 index 051ec73..0000000 --- a/test-suite/tests/valid/array-mixed-types-arrays-and-ints.toml +++ /dev/null @@ -1 +0,0 @@ -arrays-and-ints = [1, ["Arrays are not integers."]] diff --git a/test-suite/tests/valid/array-mixed-types-ints-and-floats.milf b/test-suite/tests/valid/array-mixed-types-ints-and-floats.milf new file mode 100644 index 0000000..a5aa9b7 --- /dev/null +++ b/test-suite/tests/valid/array-mixed-types-ints-and-floats.milf @@ -0,0 +1 @@ +ints-and-floats = [1, 1.1] diff --git a/test-suite/tests/valid/array-mixed-types-ints-and-floats.toml b/test-suite/tests/valid/array-mixed-types-ints-and-floats.toml deleted file mode 100644 index a5aa9b7..0000000 --- a/test-suite/tests/valid/array-mixed-types-ints-and-floats.toml +++ /dev/null @@ -1 +0,0 @@ -ints-and-floats = [1, 1.1] diff --git a/test-suite/tests/valid/array-mixed-types-strings-and-ints.milf b/test-suite/tests/valid/array-mixed-types-strings-and-ints.milf new file mode 100644 index 0000000..f348308 --- /dev/null +++ b/test-suite/tests/valid/array-mixed-types-strings-and-ints.milf @@ -0,0 +1 @@ +strings-and-ints = ["hi", 42] diff --git a/test-suite/tests/valid/array-mixed-types-strings-and-ints.toml b/test-suite/tests/valid/array-mixed-types-strings-and-ints.toml deleted file mode 100644 index f348308..0000000 --- a/test-suite/tests/valid/array-mixed-types-strings-and-ints.toml +++ /dev/null @@ -1 +0,0 @@ -strings-and-ints = ["hi", 42] diff --git a/test-suite/tests/valid/array-nospaces.milf b/test-suite/tests/valid/array-nospaces.milf new file mode 100644 index 0000000..6618936 --- /dev/null +++ b/test-suite/tests/valid/array-nospaces.milf @@ -0,0 +1 @@ +ints = [1,2,3] diff --git a/test-suite/tests/valid/array-nospaces.toml b/test-suite/tests/valid/array-nospaces.toml deleted file mode 100644 index 6618936..0000000 --- a/test-suite/tests/valid/array-nospaces.toml +++ /dev/null @@ -1 +0,0 @@ -ints = [1,2,3] diff --git a/test-suite/tests/valid/arrays-hetergeneous.milf b/test-suite/tests/valid/arrays-hetergeneous.milf new file mode 100644 index 0000000..a246fcf --- /dev/null +++ b/test-suite/tests/valid/arrays-hetergeneous.milf @@ -0,0 +1 @@ +mixed = [[1, 2], ["a", "b"], [1.1, 2.1]] diff --git a/test-suite/tests/valid/arrays-hetergeneous.toml b/test-suite/tests/valid/arrays-hetergeneous.toml deleted file mode 100644 index a246fcf..0000000 --- a/test-suite/tests/valid/arrays-hetergeneous.toml +++ /dev/null @@ -1 +0,0 @@ -mixed = [[1, 2], ["a", "b"], [1.1, 2.1]] diff --git a/test-suite/tests/valid/arrays-nested.milf b/test-suite/tests/valid/arrays-nested.milf new file mode 100644 index 0000000..ce33022 --- /dev/null +++ b/test-suite/tests/valid/arrays-nested.milf @@ -0,0 +1 @@ +nest = [["a"], ["b"]] diff --git a/test-suite/tests/valid/arrays-nested.toml b/test-suite/tests/valid/arrays-nested.toml deleted file mode 100644 index ce33022..0000000 --- a/test-suite/tests/valid/arrays-nested.toml +++ /dev/null @@ -1 +0,0 @@ -nest = [["a"], ["b"]] diff --git a/test-suite/tests/valid/arrays.milf b/test-suite/tests/valid/arrays.milf new file mode 100644 index 0000000..c435f57 --- /dev/null +++ b/test-suite/tests/valid/arrays.milf @@ -0,0 +1,8 @@ +ints = [1, 2, 3] +floats = [1.1, 2.1, 3.1] +strings = ["a", "b", "c"] +dates = [ + 1987-07-05T17:45:00Z, + 1979-05-27T07:32:00Z, + 2006-06-01T11:00:00Z, +] diff --git a/test-suite/tests/valid/arrays.toml b/test-suite/tests/valid/arrays.toml deleted file mode 100644 index c435f57..0000000 --- a/test-suite/tests/valid/arrays.toml +++ /dev/null @@ -1,8 +0,0 @@ -ints = [1, 2, 3] -floats = [1.1, 2.1, 3.1] -strings = ["a", "b", "c"] -dates = [ - 1987-07-05T17:45:00Z, - 1979-05-27T07:32:00Z, - 2006-06-01T11:00:00Z, -] diff --git a/test-suite/tests/valid/bool.milf b/test-suite/tests/valid/bool.milf new file mode 100644 index 0000000..a8a829b --- /dev/null +++ b/test-suite/tests/valid/bool.milf @@ -0,0 +1,2 @@ +t = true +f = false diff --git a/test-suite/tests/valid/bool.toml b/test-suite/tests/valid/bool.toml deleted file mode 100644 index a8a829b..0000000 --- a/test-suite/tests/valid/bool.toml +++ /dev/null @@ -1,2 +0,0 @@ -t = true -f = false diff --git a/test-suite/tests/valid/comments-everywhere.milf b/test-suite/tests/valid/comments-everywhere.milf new file mode 100644 index 0000000..3dca74c --- /dev/null +++ b/test-suite/tests/valid/comments-everywhere.milf @@ -0,0 +1,24 @@ +# Top comment. + # Top comment. +# Top comment. + +# [no-extraneous-groups-please] + +[group] # Comment +answer = 42 # Comment +# no-extraneous-keys-please = 999 +# Inbetween comment. +more = [ # Comment + # What about multiple # comments? + # Can you handle it? + # + # Evil. +# Evil. + 42, 42, # Comments within arrays are fun. + # What about multiple # comments? + # Can you handle it? + # + # Evil. +# Evil. +# ] Did I fool you? +] # Hopefully not. diff --git a/test-suite/tests/valid/comments-everywhere.toml b/test-suite/tests/valid/comments-everywhere.toml deleted file mode 100644 index 3dca74c..0000000 --- a/test-suite/tests/valid/comments-everywhere.toml +++ /dev/null @@ -1,24 +0,0 @@ -# Top comment. - # Top comment. -# Top comment. - -# [no-extraneous-groups-please] - -[group] # Comment -answer = 42 # Comment -# no-extraneous-keys-please = 999 -# Inbetween comment. -more = [ # Comment - # What about multiple # comments? - # Can you handle it? - # - # Evil. -# Evil. - 42, 42, # Comments within arrays are fun. - # What about multiple # comments? - # Can you handle it? - # - # Evil. -# Evil. -# ] Did I fool you? -] # Hopefully not. diff --git a/test-suite/tests/valid/datetime-truncate.milf b/test-suite/tests/valid/datetime-truncate.milf new file mode 100644 index 0000000..05de841 --- /dev/null +++ b/test-suite/tests/valid/datetime-truncate.milf @@ -0,0 +1 @@ +bestdayever = 1987-07-05T17:45:00.123456789012345Z diff --git a/test-suite/tests/valid/datetime-truncate.toml b/test-suite/tests/valid/datetime-truncate.toml deleted file mode 100644 index 05de841..0000000 --- a/test-suite/tests/valid/datetime-truncate.toml +++ /dev/null @@ -1 +0,0 @@ -bestdayever = 1987-07-05T17:45:00.123456789012345Z diff --git a/test-suite/tests/valid/datetime.milf b/test-suite/tests/valid/datetime.milf new file mode 100644 index 0000000..2e99340 --- /dev/null +++ b/test-suite/tests/valid/datetime.milf @@ -0,0 +1 @@ +bestdayever = 1987-07-05T17:45:00Z diff --git a/test-suite/tests/valid/datetime.toml b/test-suite/tests/valid/datetime.toml deleted file mode 100644 index 2e99340..0000000 --- a/test-suite/tests/valid/datetime.toml +++ /dev/null @@ -1 +0,0 @@ -bestdayever = 1987-07-05T17:45:00Z diff --git a/test-suite/tests/valid/dotted-keys.milf b/test-suite/tests/valid/dotted-keys.milf new file mode 100644 index 0000000..234d64c --- /dev/null +++ b/test-suite/tests/valid/dotted-keys.milf @@ -0,0 +1,7 @@ +a.b = 123 + +[table] +a.b.c = 1 +a . b . d = 2 + +in = { type.name = "cat", type.color = "blue" } diff --git a/test-suite/tests/valid/dotted-keys.toml b/test-suite/tests/valid/dotted-keys.toml deleted file mode 100644 index 234d64c..0000000 --- a/test-suite/tests/valid/dotted-keys.toml +++ /dev/null @@ -1,7 +0,0 @@ -a.b = 123 - -[table] -a.b.c = 1 -a . b . d = 2 - -in = { type.name = "cat", type.color = "blue" } diff --git a/test-suite/tests/valid/empty.milf b/test-suite/tests/valid/empty.milf new file mode 100644 index 0000000..e69de29 diff --git a/test-suite/tests/valid/empty.toml b/test-suite/tests/valid/empty.toml deleted file mode 100644 index e69de29..0000000 diff --git a/test-suite/tests/valid/example-bom.milf b/test-suite/tests/valid/example-bom.milf new file mode 100644 index 0000000..fb5ac81 --- /dev/null +++ b/test-suite/tests/valid/example-bom.milf @@ -0,0 +1,5 @@ +best-day-ever = 1987-07-05T17:45:00Z + +[numtheory] +boring = false +perfection = [6, 28, 496] diff --git a/test-suite/tests/valid/example-bom.toml b/test-suite/tests/valid/example-bom.toml deleted file mode 100644 index fb5ac81..0000000 --- a/test-suite/tests/valid/example-bom.toml +++ /dev/null @@ -1,5 +0,0 @@ -best-day-ever = 1987-07-05T17:45:00Z - -[numtheory] -boring = false -perfection = [6, 28, 496] diff --git a/test-suite/tests/valid/example-v0.3.0.milf b/test-suite/tests/valid/example-v0.3.0.milf new file mode 100644 index 0000000..dff4c8a --- /dev/null +++ b/test-suite/tests/valid/example-v0.3.0.milf @@ -0,0 +1,182 @@ +# Comment +# I am a comment. Hear me roar. Roar. + +# Table +# Tables (also known as hash tables or dictionaries) are collections of key/value pairs. +# They appear in square brackets on a line by themselves. + +[Table] + +key = "value" # Yeah, you can do this. + +# Nested tables are denoted by table names with dots in them. Name your tables whatever crap you please, just don't use #, ., [ or ]. + +[dog.tater] +type = "pug" + +# You don't need to specify all the super-tables if you don't want to. MILF knows how to do it for you. + +# [x] you +# [x.y] don't +# [x.y.z] need these +[x.y.z.w] # for this to work + +# String +# There are four ways to express strings: basic, multi-line basic, literal, and multi-line literal. +# All strings must contain only valid UTF-8 characters. + +[String] +basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." + +[String.Multiline] + +# The following strings are byte-for-byte equivalent: +key1 = "One\nTwo" +key2 = """One\nTwo""" +key3 = """ +One +Two""" + +[String.Multilined.Singleline] + +# The following strings are byte-for-byte equivalent: +key1 = "The quick brown fox jumps over the lazy dog." + +key2 = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + +key3 = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ + +[String.Literal] + +# What you see is what you get. +winpath = 'C:\Users\nodejs\templates' +winpath2 = '\\ServerX\admin$\system32\' +quoted = 'Tom "Dubs" Preston-Werner' +regex = '<\i\c*\s*>' + + +[String.Literal.Multiline] + +regex2 = '''I [dw]on't need \d{2} apples''' +lines = ''' +The first newline is +trimmed in raw strings. + All other whitespace + is preserved. +''' + +# Integer +# Integers are whole numbers. Positive numbers may be prefixed with a plus sign. +# Negative numbers are prefixed with a minus sign. + +[Integer] +key1 = +99 +key2 = 42 +key3 = 0 +key4 = -17 + +# Float +# A float consists of an integer part (which may be prefixed with a plus or minus sign) +# followed by a fractional part and/or an exponent part. + +[Float.fractional] + +# fractional +key1 = +1.0 +key2 = 3.1415 +key3 = -0.01 + +[Float.exponent] + +# exponent +#key1 = 5e+22 +#key2 = 1e6 +#key3 = -2E-2 + +[Float.both] + +# both +#key = 6.626e-34 + +# Boolean +# Booleans are just the tokens you're used to. Always lowercase. + +[Booleans] +True = true +False = false + +# Datetime +# Datetimes are RFC 3339 dates. + +[Datetime] +key1 = 1979-05-27T07:32:00Z +#key2 = 1979-05-27T00:32:00-07:00 +#key3 = 1979-05-27T00:32:00.999999-07:00 + +# Array +# Arrays are square brackets with other primitives inside. Whitespace is ignored. Elements are separated by commas. Data types may not be mixed. + +[Array] +key1 = [ 1, 2, 3 ] +key2 = [ "red", "yellow", "green" ] +key3 = [ [ 1, 2 ], [3, 4, 5] ] +key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok + +#Arrays can also be multiline. So in addition to ignoring whitespace, arrays also ignore newlines between the brackets. +# Terminating commas are ok before the closing bracket. + +key5 = [ + 1, 2, 3 +] +key6 = [ + 1, + 2, # this is ok +] + +# Array of Tables +# These can be expressed by using a table name in double brackets. +# Each table with the same double bracketed name will be an element in the array. +# The tables are inserted in the order encountered. + +[[products]] +name = "Hammer" +sku = 738594937 + +[[products]] + +[[products]] +name = "Nail" +sku = 284758393 +color = "gray" + + +# You can create nested arrays of tables as well. + +[[fruit]] + name = "apple" + + [fruit.physical] + color = "red" + shape = "round" + + [[fruit.variety]] + name = "red delicious" + + [[fruit.variety]] + name = "granny smith" + +[[fruit]] + name = "banana" + + [[fruit.variety]] + name = "plantain" + diff --git a/test-suite/tests/valid/example-v0.3.0.toml b/test-suite/tests/valid/example-v0.3.0.toml deleted file mode 100644 index 76aacc3..0000000 --- a/test-suite/tests/valid/example-v0.3.0.toml +++ /dev/null @@ -1,182 +0,0 @@ -# Comment -# I am a comment. Hear me roar. Roar. - -# Table -# Tables (also known as hash tables or dictionaries) are collections of key/value pairs. -# They appear in square brackets on a line by themselves. - -[Table] - -key = "value" # Yeah, you can do this. - -# Nested tables are denoted by table names with dots in them. Name your tables whatever crap you please, just don't use #, ., [ or ]. - -[dog.tater] -type = "pug" - -# You don't need to specify all the super-tables if you don't want to. TOML knows how to do it for you. - -# [x] you -# [x.y] don't -# [x.y.z] need these -[x.y.z.w] # for this to work - -# String -# There are four ways to express strings: basic, multi-line basic, literal, and multi-line literal. -# All strings must contain only valid UTF-8 characters. - -[String] -basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." - -[String.Multiline] - -# The following strings are byte-for-byte equivalent: -key1 = "One\nTwo" -key2 = """One\nTwo""" -key3 = """ -One -Two""" - -[String.Multilined.Singleline] - -# The following strings are byte-for-byte equivalent: -key1 = "The quick brown fox jumps over the lazy dog." - -key2 = """ -The quick brown \ - - - fox jumps over \ - the lazy dog.""" - -key3 = """\ - The quick brown \ - fox jumps over \ - the lazy dog.\ - """ - -[String.Literal] - -# What you see is what you get. -winpath = 'C:\Users\nodejs\templates' -winpath2 = '\\ServerX\admin$\system32\' -quoted = 'Tom "Dubs" Preston-Werner' -regex = '<\i\c*\s*>' - - -[String.Literal.Multiline] - -regex2 = '''I [dw]on't need \d{2} apples''' -lines = ''' -The first newline is -trimmed in raw strings. - All other whitespace - is preserved. -''' - -# Integer -# Integers are whole numbers. Positive numbers may be prefixed with a plus sign. -# Negative numbers are prefixed with a minus sign. - -[Integer] -key1 = +99 -key2 = 42 -key3 = 0 -key4 = -17 - -# Float -# A float consists of an integer part (which may be prefixed with a plus or minus sign) -# followed by a fractional part and/or an exponent part. - -[Float.fractional] - -# fractional -key1 = +1.0 -key2 = 3.1415 -key3 = -0.01 - -[Float.exponent] - -# exponent -#key1 = 5e+22 -#key2 = 1e6 -#key3 = -2E-2 - -[Float.both] - -# both -#key = 6.626e-34 - -# Boolean -# Booleans are just the tokens you're used to. Always lowercase. - -[Booleans] -True = true -False = false - -# Datetime -# Datetimes are RFC 3339 dates. - -[Datetime] -key1 = 1979-05-27T07:32:00Z -#key2 = 1979-05-27T00:32:00-07:00 -#key3 = 1979-05-27T00:32:00.999999-07:00 - -# Array -# Arrays are square brackets with other primitives inside. Whitespace is ignored. Elements are separated by commas. Data types may not be mixed. - -[Array] -key1 = [ 1, 2, 3 ] -key2 = [ "red", "yellow", "green" ] -key3 = [ [ 1, 2 ], [3, 4, 5] ] -key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok - -#Arrays can also be multiline. So in addition to ignoring whitespace, arrays also ignore newlines between the brackets. -# Terminating commas are ok before the closing bracket. - -key5 = [ - 1, 2, 3 -] -key6 = [ - 1, - 2, # this is ok -] - -# Array of Tables -# These can be expressed by using a table name in double brackets. -# Each table with the same double bracketed name will be an element in the array. -# The tables are inserted in the order encountered. - -[[products]] -name = "Hammer" -sku = 738594937 - -[[products]] - -[[products]] -name = "Nail" -sku = 284758393 -color = "gray" - - -# You can create nested arrays of tables as well. - -[[fruit]] - name = "apple" - - [fruit.physical] - color = "red" - shape = "round" - - [[fruit.variety]] - name = "red delicious" - - [[fruit.variety]] - name = "granny smith" - -[[fruit]] - name = "banana" - - [[fruit.variety]] - name = "plantain" - diff --git a/test-suite/tests/valid/example-v0.4.0.milf b/test-suite/tests/valid/example-v0.4.0.milf new file mode 100644 index 0000000..061e3c8 --- /dev/null +++ b/test-suite/tests/valid/example-v0.4.0.milf @@ -0,0 +1,236 @@ +################################################################################ +## Comment + +# Speak your mind with the hash symbol. They go from the symbol to the end of +# the line. + + +################################################################################ +## Table + +# Tables (also known as hash tables or dictionaries) are collections of +# key/value pairs. They appear in square brackets on a line by themselves. + +[table] + +key = "value" # Yeah, you can do this. + +# Nested tables are denoted by table names with dots in them. Name your tables +# whatever crap you please, just don't use #, ., [ or ]. + +[table.subtable] + +key = "another value" + +# You don't need to specify all the super-tables if you don't want to. MILF +# knows how to do it for you. + +# [x] you +# [x.y] don't +# [x.y.z] need these +[x.y.z.w] # for this to work + + +################################################################################ +## Inline Table + +# Inline tables provide a more compact syntax for expressing tables. They are +# especially useful for grouped data that can otherwise quickly become verbose. +# Inline tables are enclosed in curly braces `{` and `}`. No newlines are +# allowed between the curly braces unless they are valid within a value. + +[table.inline] + +name = { first = "Tom", last = "Preston-Werner" } +point = { x = 1, y = 2 } + + +################################################################################ +## String + +# There are four ways to express strings: basic, multi-line basic, literal, and +# multi-line literal. All strings must contain only valid UTF-8 characters. + +[string.basic] + +basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." + +[string.multiline] + +# The following strings are byte-for-byte equivalent: +key1 = "One\nTwo" +key2 = """One\nTwo""" +key3 = """ +One +Two""" + +[string.multiline.continued] + +# The following strings are byte-for-byte equivalent: +key1 = "The quick brown fox jumps over the lazy dog." + +key2 = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + +key3 = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ + +[string.literal] + +# What you see is what you get. +winpath = 'C:\Users\nodejs\templates' +winpath2 = '\\ServerX\admin$\system32\' +quoted = 'Tom "Dubs" Preston-Werner' +regex = '<\i\c*\s*>' + + +[string.literal.multiline] + +regex2 = '''I [dw]on't need \d{2} apples''' +lines = ''' +The first newline is +trimmed in raw strings. + All other whitespace + is preserved. +''' + + +################################################################################ +## Integer + +# Integers are whole numbers. Positive numbers may be prefixed with a plus sign. +# Negative numbers are prefixed with a minus sign. + +[integer] + +key1 = +99 +key2 = 42 +key3 = 0 +key4 = -17 + +[integer.underscores] + +# For large numbers, you may use underscores to enhance readability. Each +# underscore must be surrounded by at least one digit. +key1 = 1_000 +key2 = 5_349_221 +key3 = 1_2_3_4_5 # valid but inadvisable + + +################################################################################ +## Float + +# A float consists of an integer part (which may be prefixed with a plus or +# minus sign) followed by a fractional part and/or an exponent part. + +[float.fractional] + +key1 = +1.0 +key2 = 3.1415 +key3 = -0.01 + +[float.exponent] + +[float.both] + +[float.underscores] + + +################################################################################ +## Boolean + +# Booleans are just the tokens you're used to. Always lowercase. + +[boolean] + +True = true +False = false + + +################################################################################ +## Datetime + +# Datetimes are RFC 3339 dates. + +[datetime] + +#key1 = 1979-05-27T07:32:00Z +#key2 = 1979-05-27T00:32:00-07:00 +#key3 = 1979-05-27T00:32:00.999999-07:00 + + +################################################################################ +## Array + +# Arrays are square brackets with other primitives inside. Whitespace is +# ignored. Elements are separated by commas. Since 2019-11-06 data types can be +# mixed. + +[array] + +key1 = [ 1, 2, 3 ] +key2 = [ "red", "yellow", "green" ] +key3 = [ [ 1, 2 ], [3, 4, 5] ] +key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok + +# Arrays can also be multiline. So in addition to ignoring whitespace, arrays +# also ignore newlines between the brackets. Terminating commas are ok before +# the closing bracket. + +key5 = [ + 1, 2, 3 +] +key6 = [ + 1, + 2, # this is ok +] + + +################################################################################ +## Array of Tables + +# These can be expressed by using a table name in double brackets. Each table +# with the same double bracketed name will be an element in the array. The +# tables are inserted in the order encountered. + +[[products]] + +name = "Hammer" +sku = 738594937 + +[[products]] + +[[products]] + +name = "Nail" +sku = 284758393 +color = "gray" + + +# You can create nested arrays of tables as well. + +[[fruit]] + name = "apple" + + [fruit.physical] + color = "red" + shape = "round" + + [[fruit.variety]] + name = "red delicious" + + [[fruit.variety]] + name = "granny smith" + +[[fruit]] + name = "banana" + + [[fruit.variety]] + name = "plantain" diff --git a/test-suite/tests/valid/example-v0.4.0.toml b/test-suite/tests/valid/example-v0.4.0.toml deleted file mode 100644 index 69f1c1b..0000000 --- a/test-suite/tests/valid/example-v0.4.0.toml +++ /dev/null @@ -1,236 +0,0 @@ -################################################################################ -## Comment - -# Speak your mind with the hash symbol. They go from the symbol to the end of -# the line. - - -################################################################################ -## Table - -# Tables (also known as hash tables or dictionaries) are collections of -# key/value pairs. They appear in square brackets on a line by themselves. - -[table] - -key = "value" # Yeah, you can do this. - -# Nested tables are denoted by table names with dots in them. Name your tables -# whatever crap you please, just don't use #, ., [ or ]. - -[table.subtable] - -key = "another value" - -# You don't need to specify all the super-tables if you don't want to. TOML -# knows how to do it for you. - -# [x] you -# [x.y] don't -# [x.y.z] need these -[x.y.z.w] # for this to work - - -################################################################################ -## Inline Table - -# Inline tables provide a more compact syntax for expressing tables. They are -# especially useful for grouped data that can otherwise quickly become verbose. -# Inline tables are enclosed in curly braces `{` and `}`. No newlines are -# allowed between the curly braces unless they are valid within a value. - -[table.inline] - -name = { first = "Tom", last = "Preston-Werner" } -point = { x = 1, y = 2 } - - -################################################################################ -## String - -# There are four ways to express strings: basic, multi-line basic, literal, and -# multi-line literal. All strings must contain only valid UTF-8 characters. - -[string.basic] - -basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." - -[string.multiline] - -# The following strings are byte-for-byte equivalent: -key1 = "One\nTwo" -key2 = """One\nTwo""" -key3 = """ -One -Two""" - -[string.multiline.continued] - -# The following strings are byte-for-byte equivalent: -key1 = "The quick brown fox jumps over the lazy dog." - -key2 = """ -The quick brown \ - - - fox jumps over \ - the lazy dog.""" - -key3 = """\ - The quick brown \ - fox jumps over \ - the lazy dog.\ - """ - -[string.literal] - -# What you see is what you get. -winpath = 'C:\Users\nodejs\templates' -winpath2 = '\\ServerX\admin$\system32\' -quoted = 'Tom "Dubs" Preston-Werner' -regex = '<\i\c*\s*>' - - -[string.literal.multiline] - -regex2 = '''I [dw]on't need \d{2} apples''' -lines = ''' -The first newline is -trimmed in raw strings. - All other whitespace - is preserved. -''' - - -################################################################################ -## Integer - -# Integers are whole numbers. Positive numbers may be prefixed with a plus sign. -# Negative numbers are prefixed with a minus sign. - -[integer] - -key1 = +99 -key2 = 42 -key3 = 0 -key4 = -17 - -[integer.underscores] - -# For large numbers, you may use underscores to enhance readability. Each -# underscore must be surrounded by at least one digit. -key1 = 1_000 -key2 = 5_349_221 -key3 = 1_2_3_4_5 # valid but inadvisable - - -################################################################################ -## Float - -# A float consists of an integer part (which may be prefixed with a plus or -# minus sign) followed by a fractional part and/or an exponent part. - -[float.fractional] - -key1 = +1.0 -key2 = 3.1415 -key3 = -0.01 - -[float.exponent] - -[float.both] - -[float.underscores] - - -################################################################################ -## Boolean - -# Booleans are just the tokens you're used to. Always lowercase. - -[boolean] - -True = true -False = false - - -################################################################################ -## Datetime - -# Datetimes are RFC 3339 dates. - -[datetime] - -#key1 = 1979-05-27T07:32:00Z -#key2 = 1979-05-27T00:32:00-07:00 -#key3 = 1979-05-27T00:32:00.999999-07:00 - - -################################################################################ -## Array - -# Arrays are square brackets with other primitives inside. Whitespace is -# ignored. Elements are separated by commas. Since 2019-11-06 data types can be -# mixed. - -[array] - -key1 = [ 1, 2, 3 ] -key2 = [ "red", "yellow", "green" ] -key3 = [ [ 1, 2 ], [3, 4, 5] ] -key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok - -# Arrays can also be multiline. So in addition to ignoring whitespace, arrays -# also ignore newlines between the brackets. Terminating commas are ok before -# the closing bracket. - -key5 = [ - 1, 2, 3 -] -key6 = [ - 1, - 2, # this is ok -] - - -################################################################################ -## Array of Tables - -# These can be expressed by using a table name in double brackets. Each table -# with the same double bracketed name will be an element in the array. The -# tables are inserted in the order encountered. - -[[products]] - -name = "Hammer" -sku = 738594937 - -[[products]] - -[[products]] - -name = "Nail" -sku = 284758393 -color = "gray" - - -# You can create nested arrays of tables as well. - -[[fruit]] - name = "apple" - - [fruit.physical] - color = "red" - shape = "round" - - [[fruit.variety]] - name = "red delicious" - - [[fruit.variety]] - name = "granny smith" - -[[fruit]] - name = "banana" - - [[fruit.variety]] - name = "plantain" diff --git a/test-suite/tests/valid/example.milf b/test-suite/tests/valid/example.milf new file mode 100644 index 0000000..8cb02e0 --- /dev/null +++ b/test-suite/tests/valid/example.milf @@ -0,0 +1,5 @@ +best-day-ever = 1987-07-05T17:45:00Z + +[numtheory] +boring = false +perfection = [6, 28, 496] diff --git a/test-suite/tests/valid/example.toml b/test-suite/tests/valid/example.toml deleted file mode 100644 index 8cb02e0..0000000 --- a/test-suite/tests/valid/example.toml +++ /dev/null @@ -1,5 +0,0 @@ -best-day-ever = 1987-07-05T17:45:00Z - -[numtheory] -boring = false -perfection = [6, 28, 496] diff --git a/test-suite/tests/valid/example2.json b/test-suite/tests/valid/example2.json index 3249a97..5471d7f 100644 --- a/test-suite/tests/valid/example2.json +++ b/test-suite/tests/valid/example2.json @@ -1 +1 @@ -{"clients":{"data":{"type":"array","value":[{"type":"array","value":[{"type":"string","value":"gamma"},{"type":"string","value":"delta"}]},{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]}]},"hosts":{"type":"array","value":[{"type":"string","value":"alpha"},{"type":"string","value":"omega"}]}},"database":{"connection_max":{"type":"integer","value":"5000"},"enabled":{"type":"bool","value":"true"},"ports":{"type":"array","value":[{"type":"integer","value":"8001"},{"type":"integer","value":"8001"},{"type":"integer","value":"8002"}]},"server":{"type":"string","value":"192.168.1.1"}},"owner":{"bio":{"type":"string","value":"GitHub Cofounder \u0026 CEO\nLikes tater tots and beer."},"dob":{"type":"datetime","value":"1979-05-27T07:32:00Z"},"name":{"type":"string","value":"Tom Preston-Werner"},"organization":{"type":"string","value":"GitHub"}},"products":[{"name":{"type":"string","value":"Hammer"},"sku":{"type":"integer","value":"738594937"}},{"color":{"type":"string","value":"gray"},"name":{"type":"string","value":"Nail"},"sku":{"type":"integer","value":"284758393"}}],"servers":{"alpha":{"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.1"}},"beta":{"country":{"type":"string","value":"中国"},"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.2"}}},"title":{"type":"string","value":"TOML Example"}} +{"clients":{"data":{"type":"array","value":[{"type":"array","value":[{"type":"string","value":"gamma"},{"type":"string","value":"delta"}]},{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]}]},"hosts":{"type":"array","value":[{"type":"string","value":"alpha"},{"type":"string","value":"omega"}]}},"database":{"connection_max":{"type":"integer","value":"5000"},"enabled":{"type":"bool","value":"true"},"ports":{"type":"array","value":[{"type":"integer","value":"8001"},{"type":"integer","value":"8001"},{"type":"integer","value":"8002"}]},"server":{"type":"string","value":"192.168.1.1"}},"owner":{"bio":{"type":"string","value":"GitHub Cofounder \u0026 CEO\nLikes tater tots and beer."},"dob":{"type":"datetime","value":"1979-05-27T07:32:00Z"},"name":{"type":"string","value":"Tom Preston-Werner"},"organization":{"type":"string","value":"GitHub"}},"products":[{"name":{"type":"string","value":"Hammer"},"sku":{"type":"integer","value":"738594937"}},{"color":{"type":"string","value":"gray"},"name":{"type":"string","value":"Nail"},"sku":{"type":"integer","value":"284758393"}}],"servers":{"alpha":{"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.1"}},"beta":{"country":{"type":"string","value":"中国"},"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.2"}}},"title":{"type":"string","value":"MILF Example"}} diff --git a/test-suite/tests/valid/example2.milf b/test-suite/tests/valid/example2.milf new file mode 100644 index 0000000..75b138c --- /dev/null +++ b/test-suite/tests/valid/example2.milf @@ -0,0 +1,47 @@ +# This is a MILF document. Boom. + +title = "MILF Example" + +[owner] +name = "Tom Preston-Werner" +organization = "GitHub" +bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." +dob = 1979-05-27T07:32:00Z # First class dates? Why not? + +[database] +server = "192.168.1.1" +ports = [ 8001, 8001, 8002 ] +connection_max = 5000 +enabled = true + +[servers] + + # You can indent as you please. Tabs or spaces. MILF don't care. + [servers.alpha] + ip = "10.0.0.1" + dc = "eqdc10" + + [servers.beta] + ip = "10.0.0.2" + dc = "eqdc10" + country = "中国" # This should be parsed as UTF-8 + +[clients] +data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it + +# Line breaks are OK when inside arrays +hosts = [ + "alpha", + "omega" +] + +# Products + + [[products]] + name = "Hammer" + sku = 738594937 + + [[products]] + name = "Nail" + sku = 284758393 + color = "gray" diff --git a/test-suite/tests/valid/example2.toml b/test-suite/tests/valid/example2.toml deleted file mode 100644 index bc12c99..0000000 --- a/test-suite/tests/valid/example2.toml +++ /dev/null @@ -1,47 +0,0 @@ -# This is a TOML document. Boom. - -title = "TOML Example" - -[owner] -name = "Tom Preston-Werner" -organization = "GitHub" -bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." -dob = 1979-05-27T07:32:00Z # First class dates? Why not? - -[database] -server = "192.168.1.1" -ports = [ 8001, 8001, 8002 ] -connection_max = 5000 -enabled = true - -[servers] - - # You can indent as you please. Tabs or spaces. TOML don't care. - [servers.alpha] - ip = "10.0.0.1" - dc = "eqdc10" - - [servers.beta] - ip = "10.0.0.2" - dc = "eqdc10" - country = "中国" # This should be parsed as UTF-8 - -[clients] -data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it - -# Line breaks are OK when inside arrays -hosts = [ - "alpha", - "omega" -] - -# Products - - [[products]] - name = "Hammer" - sku = 738594937 - - [[products]] - name = "Nail" - sku = 284758393 - color = "gray" diff --git a/test-suite/tests/valid/float-exponent.milf b/test-suite/tests/valid/float-exponent.milf new file mode 100644 index 0000000..5349db3 --- /dev/null +++ b/test-suite/tests/valid/float-exponent.milf @@ -0,0 +1,9 @@ +lower = 3e2 +upper = 3E2 +neg = 3e-2 +pos = 3E+2 +zero = 3e0 +pointlower = 3.1e2 +pointupper = 3.1E2 +prefix-zero-exp = 1e06 +prefix-zero-exp-plus = 1e+06 diff --git a/test-suite/tests/valid/float-exponent.toml b/test-suite/tests/valid/float-exponent.toml deleted file mode 100644 index 5349db3..0000000 --- a/test-suite/tests/valid/float-exponent.toml +++ /dev/null @@ -1,9 +0,0 @@ -lower = 3e2 -upper = 3E2 -neg = 3e-2 -pos = 3E+2 -zero = 3e0 -pointlower = 3.1e2 -pointupper = 3.1E2 -prefix-zero-exp = 1e06 -prefix-zero-exp-plus = 1e+06 diff --git a/test-suite/tests/valid/float.milf b/test-suite/tests/valid/float.milf new file mode 100644 index 0000000..7c528d2 --- /dev/null +++ b/test-suite/tests/valid/float.milf @@ -0,0 +1,2 @@ +pi = 3.14 +negpi = -3.14 diff --git a/test-suite/tests/valid/float.toml b/test-suite/tests/valid/float.toml deleted file mode 100644 index 7c528d2..0000000 --- a/test-suite/tests/valid/float.toml +++ /dev/null @@ -1,2 +0,0 @@ -pi = 3.14 -negpi = -3.14 diff --git a/test-suite/tests/valid/hard_example.milf b/test-suite/tests/valid/hard_example.milf new file mode 100644 index 0000000..d2181ec --- /dev/null +++ b/test-suite/tests/valid/hard_example.milf @@ -0,0 +1,33 @@ +# Test file for MILF +# Only this one tries to emulate a MILF file written by a user of the kind of parser writers probably hate +# This part you'll really hate + +[the] +test_string = "You'll hate me after this - #" # " Annoying, isn't it? + + [the.hard] + test_array = [ "] ", " # "] # ] There you go, parse this! + test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ] + # You didn't think it'd as easy as chucking out the last #, did you? + another_test_string = " Same thing, but with a string #" + harder_test_string = " And when \"'s are in the string, along with # \"" # "and comments are there too" + # Things will get harder + + [the.hard."bit#"] + "what?" = "You don't think some user won't do that?" + multi_line_array = [ + "]", + # ] Oh yes I did + ] + +# Each of the following keygroups/key value pairs should produce an error. Uncomment to them to test + +#[error] if you didn't catch this, your parser is broken +#string = "Anything other than tabs, spaces and newline after a keygroup or key value pair has ended should produce an error unless it is a comment" like this +#array = [ +# "This might most likely happen in multiline arrays", +# Like here, +# "or here, +# and here" +# ] End of array comment, forgot the # +#number = 3.14 pi <--again forgot the # diff --git a/test-suite/tests/valid/hard_example.toml b/test-suite/tests/valid/hard_example.toml deleted file mode 100644 index 38856c8..0000000 --- a/test-suite/tests/valid/hard_example.toml +++ /dev/null @@ -1,33 +0,0 @@ -# Test file for TOML -# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate -# This part you'll really hate - -[the] -test_string = "You'll hate me after this - #" # " Annoying, isn't it? - - [the.hard] - test_array = [ "] ", " # "] # ] There you go, parse this! - test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ] - # You didn't think it'd as easy as chucking out the last #, did you? - another_test_string = " Same thing, but with a string #" - harder_test_string = " And when \"'s are in the string, along with # \"" # "and comments are there too" - # Things will get harder - - [the.hard."bit#"] - "what?" = "You don't think some user won't do that?" - multi_line_array = [ - "]", - # ] Oh yes I did - ] - -# Each of the following keygroups/key value pairs should produce an error. Uncomment to them to test - -#[error] if you didn't catch this, your parser is broken -#string = "Anything other than tabs, spaces and newline after a keygroup or key value pair has ended should produce an error unless it is a comment" like this -#array = [ -# "This might most likely happen in multiline arrays", -# Like here, -# "or here, -# and here" -# ] End of array comment, forgot the # -#number = 3.14 pi <--again forgot the # diff --git a/test-suite/tests/valid/implicit-and-explicit-after.milf b/test-suite/tests/valid/implicit-and-explicit-after.milf new file mode 100644 index 0000000..c0e8865 --- /dev/null +++ b/test-suite/tests/valid/implicit-and-explicit-after.milf @@ -0,0 +1,5 @@ +[a.b.c] +answer = 42 + +[a] +better = 43 diff --git a/test-suite/tests/valid/implicit-and-explicit-after.toml b/test-suite/tests/valid/implicit-and-explicit-after.toml deleted file mode 100644 index c0e8865..0000000 --- a/test-suite/tests/valid/implicit-and-explicit-after.toml +++ /dev/null @@ -1,5 +0,0 @@ -[a.b.c] -answer = 42 - -[a] -better = 43 diff --git a/test-suite/tests/valid/implicit-and-explicit-before.milf b/test-suite/tests/valid/implicit-and-explicit-before.milf new file mode 100644 index 0000000..eee68ff --- /dev/null +++ b/test-suite/tests/valid/implicit-and-explicit-before.milf @@ -0,0 +1,5 @@ +[a] +better = 43 + +[a.b.c] +answer = 42 diff --git a/test-suite/tests/valid/implicit-and-explicit-before.toml b/test-suite/tests/valid/implicit-and-explicit-before.toml deleted file mode 100644 index eee68ff..0000000 --- a/test-suite/tests/valid/implicit-and-explicit-before.toml +++ /dev/null @@ -1,5 +0,0 @@ -[a] -better = 43 - -[a.b.c] -answer = 42 diff --git a/test-suite/tests/valid/implicit-groups.milf b/test-suite/tests/valid/implicit-groups.milf new file mode 100644 index 0000000..b6333e4 --- /dev/null +++ b/test-suite/tests/valid/implicit-groups.milf @@ -0,0 +1,2 @@ +[a.b.c] +answer = 42 diff --git a/test-suite/tests/valid/implicit-groups.toml b/test-suite/tests/valid/implicit-groups.toml deleted file mode 100644 index b6333e4..0000000 --- a/test-suite/tests/valid/implicit-groups.toml +++ /dev/null @@ -1,2 +0,0 @@ -[a.b.c] -answer = 42 diff --git a/test-suite/tests/valid/integer.milf b/test-suite/tests/valid/integer.milf new file mode 100644 index 0000000..8362459 --- /dev/null +++ b/test-suite/tests/valid/integer.milf @@ -0,0 +1,18 @@ +answer = 42 +neganswer = -42 + +neg_zero = -0 +pos_zero = +0 + +# hexadecimal with prefix `0x` +hex1 = 0xDEADBEEF +hex2 = 0xdeadbeef +hex3 = 0xdead_beef + +# octal with prefix `0o` +oct1 = 0o01234567 +oct2 = 0o755 # useful for Unix file permissions + +# binary with prefix `0b` +bin1 = 0b11010110 + diff --git a/test-suite/tests/valid/integer.toml b/test-suite/tests/valid/integer.toml deleted file mode 100644 index 8362459..0000000 --- a/test-suite/tests/valid/integer.toml +++ /dev/null @@ -1,18 +0,0 @@ -answer = 42 -neganswer = -42 - -neg_zero = -0 -pos_zero = +0 - -# hexadecimal with prefix `0x` -hex1 = 0xDEADBEEF -hex2 = 0xdeadbeef -hex3 = 0xdead_beef - -# octal with prefix `0o` -oct1 = 0o01234567 -oct2 = 0o755 # useful for Unix file permissions - -# binary with prefix `0b` -bin1 = 0b11010110 - diff --git a/test-suite/tests/valid/key-equals-nospace.milf b/test-suite/tests/valid/key-equals-nospace.milf new file mode 100644 index 0000000..560901c --- /dev/null +++ b/test-suite/tests/valid/key-equals-nospace.milf @@ -0,0 +1 @@ +answer=42 diff --git a/test-suite/tests/valid/key-equals-nospace.toml b/test-suite/tests/valid/key-equals-nospace.toml deleted file mode 100644 index 560901c..0000000 --- a/test-suite/tests/valid/key-equals-nospace.toml +++ /dev/null @@ -1 +0,0 @@ -answer=42 diff --git a/test-suite/tests/valid/key-quote-newline.milf b/test-suite/tests/valid/key-quote-newline.milf new file mode 100644 index 0000000..a2639bf --- /dev/null +++ b/test-suite/tests/valid/key-quote-newline.milf @@ -0,0 +1 @@ +"\n" = 1 diff --git a/test-suite/tests/valid/key-quote-newline.toml b/test-suite/tests/valid/key-quote-newline.toml deleted file mode 100644 index a2639bf..0000000 --- a/test-suite/tests/valid/key-quote-newline.toml +++ /dev/null @@ -1 +0,0 @@ -"\n" = 1 diff --git a/test-suite/tests/valid/key-space.milf b/test-suite/tests/valid/key-space.milf new file mode 100644 index 0000000..f4f36c4 --- /dev/null +++ b/test-suite/tests/valid/key-space.milf @@ -0,0 +1 @@ +"a b" = 1 diff --git a/test-suite/tests/valid/key-space.toml b/test-suite/tests/valid/key-space.toml deleted file mode 100644 index f4f36c4..0000000 --- a/test-suite/tests/valid/key-space.toml +++ /dev/null @@ -1 +0,0 @@ -"a b" = 1 diff --git a/test-suite/tests/valid/key-special-chars.milf b/test-suite/tests/valid/key-special-chars.milf new file mode 100644 index 0000000..dc43625 --- /dev/null +++ b/test-suite/tests/valid/key-special-chars.milf @@ -0,0 +1 @@ +"~!@#$^&*()_+-`1234567890[]\\|/?><.,;:'" = 1 diff --git a/test-suite/tests/valid/key-special-chars.toml b/test-suite/tests/valid/key-special-chars.toml deleted file mode 100644 index dc43625..0000000 --- a/test-suite/tests/valid/key-special-chars.toml +++ /dev/null @@ -1 +0,0 @@ -"~!@#$^&*()_+-`1234567890[]\\|/?><.,;:'" = 1 diff --git a/test-suite/tests/valid/key-with-pound.milf b/test-suite/tests/valid/key-with-pound.milf new file mode 100644 index 0000000..65b766f --- /dev/null +++ b/test-suite/tests/valid/key-with-pound.milf @@ -0,0 +1 @@ +"key#name" = 5 diff --git a/test-suite/tests/valid/key-with-pound.toml b/test-suite/tests/valid/key-with-pound.toml deleted file mode 100644 index 65b766f..0000000 --- a/test-suite/tests/valid/key-with-pound.toml +++ /dev/null @@ -1 +0,0 @@ -"key#name" = 5 diff --git a/test-suite/tests/valid/long-float.milf b/test-suite/tests/valid/long-float.milf new file mode 100644 index 0000000..9558ae4 --- /dev/null +++ b/test-suite/tests/valid/long-float.milf @@ -0,0 +1,2 @@ +longpi = 3.141592653589793 +neglongpi = -3.141592653589793 diff --git a/test-suite/tests/valid/long-float.toml b/test-suite/tests/valid/long-float.toml deleted file mode 100644 index 9558ae4..0000000 --- a/test-suite/tests/valid/long-float.toml +++ /dev/null @@ -1,2 +0,0 @@ -longpi = 3.141592653589793 -neglongpi = -3.141592653589793 diff --git a/test-suite/tests/valid/long-integer.milf b/test-suite/tests/valid/long-integer.milf new file mode 100644 index 0000000..424a13a --- /dev/null +++ b/test-suite/tests/valid/long-integer.milf @@ -0,0 +1,2 @@ +answer = 9223372036854775807 +neganswer = -9223372036854775808 diff --git a/test-suite/tests/valid/long-integer.toml b/test-suite/tests/valid/long-integer.toml deleted file mode 100644 index 424a13a..0000000 --- a/test-suite/tests/valid/long-integer.toml +++ /dev/null @@ -1,2 +0,0 @@ -answer = 9223372036854775807 -neganswer = -9223372036854775808 diff --git a/test-suite/tests/valid/multiline-string.milf b/test-suite/tests/valid/multiline-string.milf new file mode 100644 index 0000000..2c4237f --- /dev/null +++ b/test-suite/tests/valid/multiline-string.milf @@ -0,0 +1,34 @@ +multiline_empty_one = """""" +multiline_empty_two = """ +""" +multiline_empty_three = """\ + """ +multiline_empty_four = """\ + \ + \ + """ +multiline_empty_five = """\ + \ + \ + \ + """ + +equivalent_one = "The quick brown fox jumps over the lazy dog." +equivalent_two = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + +equivalent_three = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ + +equivalent_four = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ diff --git a/test-suite/tests/valid/multiline-string.toml b/test-suite/tests/valid/multiline-string.toml deleted file mode 100644 index 2c4237f..0000000 --- a/test-suite/tests/valid/multiline-string.toml +++ /dev/null @@ -1,34 +0,0 @@ -multiline_empty_one = """""" -multiline_empty_two = """ -""" -multiline_empty_three = """\ - """ -multiline_empty_four = """\ - \ - \ - """ -multiline_empty_five = """\ - \ - \ - \ - """ - -equivalent_one = "The quick brown fox jumps over the lazy dog." -equivalent_two = """ -The quick brown \ - - - fox jumps over \ - the lazy dog.""" - -equivalent_three = """\ - The quick brown \ - fox jumps over \ - the lazy dog.\ - """ - -equivalent_four = """\ - The quick brown \ - fox jumps over \ - the lazy dog.\ - """ diff --git a/test-suite/tests/valid/quote-surrounded-value.milf b/test-suite/tests/valid/quote-surrounded-value.milf new file mode 100644 index 0000000..dc8697e --- /dev/null +++ b/test-suite/tests/valid/quote-surrounded-value.milf @@ -0,0 +1,2 @@ +double = '"double quotes here"' +single = "'single quotes here'" diff --git a/test-suite/tests/valid/quote-surrounded-value.toml b/test-suite/tests/valid/quote-surrounded-value.toml deleted file mode 100644 index dc8697e..0000000 --- a/test-suite/tests/valid/quote-surrounded-value.toml +++ /dev/null @@ -1,2 +0,0 @@ -double = '"double quotes here"' -single = "'single quotes here'" diff --git a/test-suite/tests/valid/raw-multiline-string.milf b/test-suite/tests/valid/raw-multiline-string.milf new file mode 100644 index 0000000..8094c03 --- /dev/null +++ b/test-suite/tests/valid/raw-multiline-string.milf @@ -0,0 +1,9 @@ +oneline = '''This string has a ' quote character.''' +firstnl = ''' +This string has a ' quote character.''' +multiline = ''' +This string +has ' a quote character +and more than +one newline +in it.''' diff --git a/test-suite/tests/valid/raw-multiline-string.toml b/test-suite/tests/valid/raw-multiline-string.toml deleted file mode 100644 index 8094c03..0000000 --- a/test-suite/tests/valid/raw-multiline-string.toml +++ /dev/null @@ -1,9 +0,0 @@ -oneline = '''This string has a ' quote character.''' -firstnl = ''' -This string has a ' quote character.''' -multiline = ''' -This string -has ' a quote character -and more than -one newline -in it.''' diff --git a/test-suite/tests/valid/raw-string.milf b/test-suite/tests/valid/raw-string.milf new file mode 100644 index 0000000..92acd25 --- /dev/null +++ b/test-suite/tests/valid/raw-string.milf @@ -0,0 +1,7 @@ +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.' +slash = 'This string has a \/ slash character.' +backslash = 'This string has a \\ backslash character.' diff --git a/test-suite/tests/valid/raw-string.toml b/test-suite/tests/valid/raw-string.toml deleted file mode 100644 index 92acd25..0000000 --- a/test-suite/tests/valid/raw-string.toml +++ /dev/null @@ -1,7 +0,0 @@ -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.' -slash = 'This string has a \/ slash character.' -backslash = 'This string has a \\ backslash character.' diff --git a/test-suite/tests/valid/string-delim-end.milf b/test-suite/tests/valid/string-delim-end.milf new file mode 100644 index 0000000..9a41219 --- /dev/null +++ b/test-suite/tests/valid/string-delim-end.milf @@ -0,0 +1,3 @@ +str1 = """"This," she said, "is just a pointless statement."""" +str2 = '''foo''bar''''' +str3 = """""""" diff --git a/test-suite/tests/valid/string-delim-end.toml b/test-suite/tests/valid/string-delim-end.toml deleted file mode 100644 index 9a41219..0000000 --- a/test-suite/tests/valid/string-delim-end.toml +++ /dev/null @@ -1,3 +0,0 @@ -str1 = """"This," she said, "is just a pointless statement."""" -str2 = '''foo''bar''''' -str3 = """""""" diff --git a/test-suite/tests/valid/string-empty.milf b/test-suite/tests/valid/string-empty.milf new file mode 100644 index 0000000..e37e681 --- /dev/null +++ b/test-suite/tests/valid/string-empty.milf @@ -0,0 +1 @@ +answer = "" diff --git a/test-suite/tests/valid/string-empty.toml b/test-suite/tests/valid/string-empty.toml deleted file mode 100644 index e37e681..0000000 --- a/test-suite/tests/valid/string-empty.toml +++ /dev/null @@ -1 +0,0 @@ -answer = "" diff --git a/test-suite/tests/valid/string-escapes.milf b/test-suite/tests/valid/string-escapes.milf new file mode 100644 index 0000000..152c6ad --- /dev/null +++ b/test-suite/tests/valid/string-escapes.milf @@ -0,0 +1,14 @@ +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." +slash = "This string has a / slash 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." diff --git a/test-suite/tests/valid/string-escapes.toml b/test-suite/tests/valid/string-escapes.toml deleted file mode 100644 index 152c6ad..0000000 --- a/test-suite/tests/valid/string-escapes.toml +++ /dev/null @@ -1,14 +0,0 @@ -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." -slash = "This string has a / slash 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." diff --git a/test-suite/tests/valid/string-simple.milf b/test-suite/tests/valid/string-simple.milf new file mode 100644 index 0000000..e17ade6 --- /dev/null +++ b/test-suite/tests/valid/string-simple.milf @@ -0,0 +1 @@ +answer = "You are not drinking enough whisky." diff --git a/test-suite/tests/valid/string-simple.toml b/test-suite/tests/valid/string-simple.toml deleted file mode 100644 index e17ade6..0000000 --- a/test-suite/tests/valid/string-simple.toml +++ /dev/null @@ -1 +0,0 @@ -answer = "You are not drinking enough whisky." diff --git a/test-suite/tests/valid/string-with-pound.milf b/test-suite/tests/valid/string-with-pound.milf new file mode 100644 index 0000000..5fd8746 --- /dev/null +++ b/test-suite/tests/valid/string-with-pound.milf @@ -0,0 +1,2 @@ +pound = "We see no # comments here." +poundcomment = "But there are # some comments here." # Did I # mess you up? diff --git a/test-suite/tests/valid/string-with-pound.toml b/test-suite/tests/valid/string-with-pound.toml deleted file mode 100644 index 5fd8746..0000000 --- a/test-suite/tests/valid/string-with-pound.toml +++ /dev/null @@ -1,2 +0,0 @@ -pound = "We see no # comments here." -poundcomment = "But there are # some comments here." # Did I # mess you up? diff --git a/test-suite/tests/valid/table-array-implicit.milf b/test-suite/tests/valid/table-array-implicit.milf new file mode 100644 index 0000000..3157ac9 --- /dev/null +++ b/test-suite/tests/valid/table-array-implicit.milf @@ -0,0 +1,2 @@ +[[albums.songs]] +name = "Glory Days" diff --git a/test-suite/tests/valid/table-array-implicit.toml b/test-suite/tests/valid/table-array-implicit.toml deleted file mode 100644 index 3157ac9..0000000 --- a/test-suite/tests/valid/table-array-implicit.toml +++ /dev/null @@ -1,2 +0,0 @@ -[[albums.songs]] -name = "Glory Days" diff --git a/test-suite/tests/valid/table-array-many.milf b/test-suite/tests/valid/table-array-many.milf new file mode 100644 index 0000000..46062be --- /dev/null +++ b/test-suite/tests/valid/table-array-many.milf @@ -0,0 +1,11 @@ +[[people]] +first_name = "Bruce" +last_name = "Springsteen" + +[[people]] +first_name = "Eric" +last_name = "Clapton" + +[[people]] +first_name = "Bob" +last_name = "Seger" diff --git a/test-suite/tests/valid/table-array-many.toml b/test-suite/tests/valid/table-array-many.toml deleted file mode 100644 index 46062be..0000000 --- a/test-suite/tests/valid/table-array-many.toml +++ /dev/null @@ -1,11 +0,0 @@ -[[people]] -first_name = "Bruce" -last_name = "Springsteen" - -[[people]] -first_name = "Eric" -last_name = "Clapton" - -[[people]] -first_name = "Bob" -last_name = "Seger" diff --git a/test-suite/tests/valid/table-array-nest-no-keys.milf b/test-suite/tests/valid/table-array-nest-no-keys.milf new file mode 100644 index 0000000..ad6eb10 --- /dev/null +++ b/test-suite/tests/valid/table-array-nest-no-keys.milf @@ -0,0 +1,6 @@ +[[ albums ]] + [[ albums.songs ]] + [[ albums.songs ]] + +[[ artists ]] + [ artists.home.address ] diff --git a/test-suite/tests/valid/table-array-nest-no-keys.toml b/test-suite/tests/valid/table-array-nest-no-keys.toml deleted file mode 100644 index ad6eb10..0000000 --- a/test-suite/tests/valid/table-array-nest-no-keys.toml +++ /dev/null @@ -1,6 +0,0 @@ -[[ albums ]] - [[ albums.songs ]] - [[ albums.songs ]] - -[[ artists ]] - [ artists.home.address ] diff --git a/test-suite/tests/valid/table-array-nest.milf b/test-suite/tests/valid/table-array-nest.milf new file mode 100644 index 0000000..d659a3d --- /dev/null +++ b/test-suite/tests/valid/table-array-nest.milf @@ -0,0 +1,17 @@ +[[albums]] +name = "Born to Run" + + [[albums.songs]] + name = "Jungleland" + + [[albums.songs]] + name = "Meeting Across the River" + +[[albums]] +name = "Born in the USA" + + [[albums.songs]] + name = "Glory Days" + + [[albums.songs]] + name = "Dancing in the Dark" diff --git a/test-suite/tests/valid/table-array-nest.toml b/test-suite/tests/valid/table-array-nest.toml deleted file mode 100644 index d659a3d..0000000 --- a/test-suite/tests/valid/table-array-nest.toml +++ /dev/null @@ -1,17 +0,0 @@ -[[albums]] -name = "Born to Run" - - [[albums.songs]] - name = "Jungleland" - - [[albums.songs]] - name = "Meeting Across the River" - -[[albums]] -name = "Born in the USA" - - [[albums.songs]] - name = "Glory Days" - - [[albums.songs]] - name = "Dancing in the Dark" diff --git a/test-suite/tests/valid/table-array-one.milf b/test-suite/tests/valid/table-array-one.milf new file mode 100644 index 0000000..cd7e1b6 --- /dev/null +++ b/test-suite/tests/valid/table-array-one.milf @@ -0,0 +1,3 @@ +[[people]] +first_name = "Bruce" +last_name = "Springsteen" diff --git a/test-suite/tests/valid/table-array-one.toml b/test-suite/tests/valid/table-array-one.toml deleted file mode 100644 index cd7e1b6..0000000 --- a/test-suite/tests/valid/table-array-one.toml +++ /dev/null @@ -1,3 +0,0 @@ -[[people]] -first_name = "Bruce" -last_name = "Springsteen" diff --git a/test-suite/tests/valid/table-empty.milf b/test-suite/tests/valid/table-empty.milf new file mode 100644 index 0000000..8bb6a0a --- /dev/null +++ b/test-suite/tests/valid/table-empty.milf @@ -0,0 +1 @@ +[a] diff --git a/test-suite/tests/valid/table-empty.toml b/test-suite/tests/valid/table-empty.toml deleted file mode 100644 index 8bb6a0a..0000000 --- a/test-suite/tests/valid/table-empty.toml +++ /dev/null @@ -1 +0,0 @@ -[a] diff --git a/test-suite/tests/valid/table-multi-empty.milf b/test-suite/tests/valid/table-multi-empty.milf new file mode 100644 index 0000000..2266ed2 --- /dev/null +++ b/test-suite/tests/valid/table-multi-empty.milf @@ -0,0 +1,5 @@ +[a] +[a.b] +[b] +[c] +[c.a] diff --git a/test-suite/tests/valid/table-multi-empty.toml b/test-suite/tests/valid/table-multi-empty.toml deleted file mode 100644 index 2266ed2..0000000 --- a/test-suite/tests/valid/table-multi-empty.toml +++ /dev/null @@ -1,5 +0,0 @@ -[a] -[a.b] -[b] -[c] -[c.a] diff --git a/test-suite/tests/valid/table-sub-empty.milf b/test-suite/tests/valid/table-sub-empty.milf new file mode 100644 index 0000000..70b7fe1 --- /dev/null +++ b/test-suite/tests/valid/table-sub-empty.milf @@ -0,0 +1,2 @@ +[a] +[a.b] diff --git a/test-suite/tests/valid/table-sub-empty.toml b/test-suite/tests/valid/table-sub-empty.toml deleted file mode 100644 index 70b7fe1..0000000 --- a/test-suite/tests/valid/table-sub-empty.toml +++ /dev/null @@ -1,2 +0,0 @@ -[a] -[a.b] diff --git a/test-suite/tests/valid/table-whitespace.milf b/test-suite/tests/valid/table-whitespace.milf new file mode 100644 index 0000000..daf881d --- /dev/null +++ b/test-suite/tests/valid/table-whitespace.milf @@ -0,0 +1 @@ +["valid key"] diff --git a/test-suite/tests/valid/table-whitespace.toml b/test-suite/tests/valid/table-whitespace.toml deleted file mode 100644 index daf881d..0000000 --- a/test-suite/tests/valid/table-whitespace.toml +++ /dev/null @@ -1 +0,0 @@ -["valid key"] diff --git a/test-suite/tests/valid/table-with-pound.milf b/test-suite/tests/valid/table-with-pound.milf new file mode 100644 index 0000000..33f2c4f --- /dev/null +++ b/test-suite/tests/valid/table-with-pound.milf @@ -0,0 +1,2 @@ +["key#group"] +answer = 42 diff --git a/test-suite/tests/valid/table-with-pound.toml b/test-suite/tests/valid/table-with-pound.toml deleted file mode 100644 index 33f2c4f..0000000 --- a/test-suite/tests/valid/table-with-pound.toml +++ /dev/null @@ -1,2 +0,0 @@ -["key#group"] -answer = 42 diff --git a/test-suite/tests/valid/unicode-escape.milf b/test-suite/tests/valid/unicode-escape.milf new file mode 100644 index 0000000..6654252 --- /dev/null +++ b/test-suite/tests/valid/unicode-escape.milf @@ -0,0 +1,6 @@ +answer1 = "\u000B" +answer4 = "\u03B4α" +answer8 = "\U000003B4β" +answer9 = "\uc0de" +answer10 = "\u03b4α" +answer11 = "\U0000abc1" diff --git a/test-suite/tests/valid/unicode-escape.toml b/test-suite/tests/valid/unicode-escape.toml deleted file mode 100644 index 6654252..0000000 --- a/test-suite/tests/valid/unicode-escape.toml +++ /dev/null @@ -1,6 +0,0 @@ -answer1 = "\u000B" -answer4 = "\u03B4α" -answer8 = "\U000003B4β" -answer9 = "\uc0de" -answer10 = "\u03b4α" -answer11 = "\U0000abc1" diff --git a/test-suite/tests/valid/unicode-literal.milf b/test-suite/tests/valid/unicode-literal.milf new file mode 100644 index 0000000..c65723c --- /dev/null +++ b/test-suite/tests/valid/unicode-literal.milf @@ -0,0 +1 @@ +answer = "δ" diff --git a/test-suite/tests/valid/unicode-literal.toml b/test-suite/tests/valid/unicode-literal.toml deleted file mode 100644 index c65723c..0000000 --- a/test-suite/tests/valid/unicode-literal.toml +++ /dev/null @@ -1 +0,0 @@ -answer = "δ" diff --git a/tests/enum_external_deserialize.rs b/tests/enum_external_deserialize.rs index 6d45b48..6bed586 100644 --- a/tests/enum_external_deserialize.rs +++ b/tests/enum_external_deserialize.rs @@ -1,6 +1,6 @@ #[macro_use] extern crate serde_derive; -extern crate toml; +extern crate milf; #[derive(Debug, Deserialize, PartialEq)] struct OuterStruct { @@ -27,7 +27,7 @@ struct Multi { #[test] fn invalid_variant_returns_error_with_good_message_string() { - let error = toml::from_str::("\"NonExistent\"").unwrap_err(); + let error = milf::from_str::("\"NonExistent\"").unwrap_err(); assert_eq!( error.to_string(), @@ -37,7 +37,7 @@ fn invalid_variant_returns_error_with_good_message_string() { #[test] fn invalid_variant_returns_error_with_good_message_inline_table() { - let error = toml::from_str::("{ NonExistent = {} }").unwrap_err(); + let error = milf::from_str::("{ NonExistent = {} }").unwrap_err(); assert_eq!( error.to_string(), "unknown variant `NonExistent`, expected one of `Plain`, `Tuple`, `NewType`, `Struct`" @@ -46,14 +46,14 @@ fn invalid_variant_returns_error_with_good_message_inline_table() { #[test] fn extra_field_returns_expected_empty_table_error() { - let error = toml::from_str::("{ Plain = { extra_field = 404 } }").unwrap_err(); + let error = milf::from_str::("{ Plain = { extra_field = 404 } }").unwrap_err(); assert_eq!(error.to_string(), "expected empty table"); } #[test] fn extra_field_returns_expected_empty_table_error_struct_variant() { - let error = toml::from_str::("{ Struct = { value = 123, extra_0 = 0, extra_1 = 1 } }") + let error = milf::from_str::("{ Struct = { value = 123, extra_0 = 0, extra_1 = 1 } }") .unwrap_err(); assert_eq!( @@ -67,23 +67,23 @@ mod enum_unit { #[test] fn from_str() { - assert_eq!(TheEnum::Plain, toml::from_str("\"Plain\"").unwrap()); + assert_eq!(TheEnum::Plain, milf::from_str("\"Plain\"").unwrap()); } #[test] fn from_inline_table() { - assert_eq!(TheEnum::Plain, toml::from_str("{ Plain = {} }").unwrap()); + assert_eq!(TheEnum::Plain, milf::from_str("{ Plain = {} }").unwrap()); assert_eq!( Val { val: TheEnum::Plain }, - toml::from_str("val = { Plain = {} }").unwrap() + milf::from_str("val = { Plain = {} }").unwrap() ); } #[test] fn from_dotted_table() { - assert_eq!(TheEnum::Plain, toml::from_str("[Plain]\n").unwrap()); + assert_eq!(TheEnum::Plain, milf::from_str("[Plain]\n").unwrap()); } } @@ -94,13 +94,13 @@ mod enum_tuple { fn from_inline_table() { assert_eq!( TheEnum::Tuple(-123, true), - toml::from_str("{ Tuple = { 0 = -123, 1 = true } }").unwrap() + milf::from_str("{ Tuple = { 0 = -123, 1 = true } }").unwrap() ); assert_eq!( Val { val: TheEnum::Tuple(-123, true) }, - toml::from_str("val = { Tuple = { 0 = -123, 1 = true } }").unwrap() + milf::from_str("val = { Tuple = { 0 = -123, 1 = true } }").unwrap() ); } @@ -108,7 +108,7 @@ mod enum_tuple { fn from_dotted_table() { assert_eq!( TheEnum::Tuple(-123, true), - toml::from_str( + milf::from_str( r#"[Tuple] 0 = -123 1 = true @@ -126,13 +126,13 @@ mod enum_newtype { fn from_inline_table() { assert_eq!( TheEnum::NewType("value".to_string()), - toml::from_str(r#"{ NewType = "value" }"#).unwrap() + milf::from_str(r#"{ NewType = "value" }"#).unwrap() ); assert_eq!( Val { val: TheEnum::NewType("value".to_string()), }, - toml::from_str(r#"val = { NewType = "value" }"#).unwrap() + milf::from_str(r#"val = { NewType = "value" }"#).unwrap() ); } @@ -141,13 +141,13 @@ mod enum_newtype { fn from_dotted_table() { assert_eq!( TheEnum::NewType("value".to_string()), - toml::from_str(r#"NewType = "value""#).unwrap() + milf::from_str(r#"NewType = "value""#).unwrap() ); assert_eq!( Val { val: TheEnum::NewType("value".to_string()), }, - toml::from_str( + milf::from_str( r#"[val] NewType = "value" "# @@ -164,13 +164,13 @@ mod enum_struct { fn from_inline_table() { assert_eq!( TheEnum::Struct { value: -123 }, - toml::from_str("{ Struct = { value = -123 } }").unwrap() + milf::from_str("{ Struct = { value = -123 } }").unwrap() ); assert_eq!( Val { val: TheEnum::Struct { value: -123 } }, - toml::from_str("val = { Struct = { value = -123 } }").unwrap() + milf::from_str("val = { Struct = { value = -123 } }").unwrap() ); } @@ -178,7 +178,7 @@ mod enum_struct { fn from_dotted_table() { assert_eq!( TheEnum::Struct { value: -123 }, - toml::from_str( + milf::from_str( r#"[Struct] value = -123 "# @@ -193,7 +193,7 @@ mod enum_struct { OuterStruct { inner: TheEnum::Struct { value: -123 } }, - toml::from_str( + milf::from_str( r#"[inner.Struct] value = -123 "# @@ -208,7 +208,7 @@ mod enum_array { #[test] fn from_inline_tables() { - let toml_str = r#" + let milf_str = r#" enums = [ { Plain = {} }, { Tuple = { 0 = -123, 1 = true } }, @@ -224,14 +224,14 @@ mod enum_array { TheEnum::Struct { value: -123 }, ] }, - toml::from_str(toml_str).unwrap() + milf::from_str(milf_str).unwrap() ); } #[test] #[ignore = "Unimplemented: https://github.com/alexcrichton/toml-rs/pull/264#issuecomment-431707209"] fn from_dotted_table() { - let toml_str = r#"[[enums]] + let milf_str = r#"[[enums]] Plain = {} [[enums]] @@ -252,7 +252,7 @@ mod enum_array { TheEnum::Struct { value: -123 }, ] }, - toml::from_str(toml_str).unwrap() + milf::from_str(milf_str).unwrap() ); } } -- cgit v1.2.3