diff --git a/src/lib.rs b/src/lib.rs index a046189..bbe13d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,7 +60,7 @@ pub use serialization::DecodeErrorKind::{ExpectedType, NilTooLong}; mod parser; mod show; mod serialization; -#[cfg(test)]mod test; + /// Representation of a TOML value. #[derive(PartialEq, Clone, Show)] #[allow(missing_docs)] diff --git a/src/test/mod.rs b/src/test/mod.rs deleted file mode 100644 index 6f2c7bd..0000000 --- a/src/test/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -mod valid; -mod invalid; diff --git a/src/test/README.md b/tests/README.md similarity index 100% rename from src/test/README.md rename to tests/README.md diff --git a/src/test/invalid-encoder/array-mixed-types-ints-and-floats.json b/tests/invalid-encoder/array-mixed-types-ints-and-floats.json similarity index 100% rename from src/test/invalid-encoder/array-mixed-types-ints-and-floats.json rename to tests/invalid-encoder/array-mixed-types-ints-and-floats.json diff --git a/src/test/invalid.rs b/tests/invalid.rs similarity index 98% rename from src/test/invalid.rs rename to tests/invalid.rs index 4f69ec6..582e25d 100644 --- a/src/test/invalid.rs +++ b/tests/invalid.rs @@ -1,4 +1,6 @@ -use {Parser}; +extern crate toml; + +use toml::{Parser}; fn run(toml: &str) { let mut p = Parser::new(toml); diff --git a/src/test/invalid/array-mixed-types-arrays-and-ints.toml b/tests/invalid/array-mixed-types-arrays-and-ints.toml similarity index 100% rename from src/test/invalid/array-mixed-types-arrays-and-ints.toml rename to tests/invalid/array-mixed-types-arrays-and-ints.toml diff --git a/src/test/invalid/array-mixed-types-ints-and-floats.toml b/tests/invalid/array-mixed-types-ints-and-floats.toml similarity index 100% rename from src/test/invalid/array-mixed-types-ints-and-floats.toml rename to tests/invalid/array-mixed-types-ints-and-floats.toml diff --git a/src/test/invalid/array-mixed-types-strings-and-ints.toml b/tests/invalid/array-mixed-types-strings-and-ints.toml similarity index 100% rename from src/test/invalid/array-mixed-types-strings-and-ints.toml rename to tests/invalid/array-mixed-types-strings-and-ints.toml diff --git a/src/test/invalid/datetime-malformed-no-leads.toml b/tests/invalid/datetime-malformed-no-leads.toml similarity index 100% rename from src/test/invalid/datetime-malformed-no-leads.toml rename to tests/invalid/datetime-malformed-no-leads.toml diff --git a/src/test/invalid/datetime-malformed-no-secs.toml b/tests/invalid/datetime-malformed-no-secs.toml similarity index 100% rename from src/test/invalid/datetime-malformed-no-secs.toml rename to tests/invalid/datetime-malformed-no-secs.toml diff --git a/src/test/invalid/datetime-malformed-no-t.toml b/tests/invalid/datetime-malformed-no-t.toml similarity index 100% rename from src/test/invalid/datetime-malformed-no-t.toml rename to tests/invalid/datetime-malformed-no-t.toml diff --git a/src/test/invalid/datetime-malformed-no-z.toml b/tests/invalid/datetime-malformed-no-z.toml similarity index 100% rename from src/test/invalid/datetime-malformed-no-z.toml rename to tests/invalid/datetime-malformed-no-z.toml diff --git a/src/test/invalid/datetime-malformed-with-milli.toml b/tests/invalid/datetime-malformed-with-milli.toml similarity index 100% rename from src/test/invalid/datetime-malformed-with-milli.toml rename to tests/invalid/datetime-malformed-with-milli.toml diff --git a/src/test/invalid/duplicate-key-table.toml b/tests/invalid/duplicate-key-table.toml similarity index 100% rename from src/test/invalid/duplicate-key-table.toml rename to tests/invalid/duplicate-key-table.toml diff --git a/src/test/invalid/duplicate-keys.toml b/tests/invalid/duplicate-keys.toml similarity index 100% rename from src/test/invalid/duplicate-keys.toml rename to tests/invalid/duplicate-keys.toml diff --git a/src/test/invalid/duplicate-tables.toml b/tests/invalid/duplicate-tables.toml similarity index 100% rename from src/test/invalid/duplicate-tables.toml rename to tests/invalid/duplicate-tables.toml diff --git a/src/test/invalid/empty-implicit-table.toml b/tests/invalid/empty-implicit-table.toml similarity index 100% rename from src/test/invalid/empty-implicit-table.toml rename to tests/invalid/empty-implicit-table.toml diff --git a/src/test/invalid/empty-table.toml b/tests/invalid/empty-table.toml similarity index 100% rename from src/test/invalid/empty-table.toml rename to tests/invalid/empty-table.toml diff --git a/src/test/invalid/float-no-leading-zero.toml b/tests/invalid/float-no-leading-zero.toml similarity index 100% rename from src/test/invalid/float-no-leading-zero.toml rename to tests/invalid/float-no-leading-zero.toml diff --git a/src/test/invalid/float-no-trailing-digits.toml b/tests/invalid/float-no-trailing-digits.toml similarity index 100% rename from src/test/invalid/float-no-trailing-digits.toml rename to tests/invalid/float-no-trailing-digits.toml diff --git a/src/test/invalid/key-two-equals.toml b/tests/invalid/key-two-equals.toml similarity index 100% rename from src/test/invalid/key-two-equals.toml rename to tests/invalid/key-two-equals.toml diff --git a/src/test/invalid/string-bad-byte-escape.toml b/tests/invalid/string-bad-byte-escape.toml similarity index 100% rename from src/test/invalid/string-bad-byte-escape.toml rename to tests/invalid/string-bad-byte-escape.toml diff --git a/src/test/invalid/string-bad-escape.toml b/tests/invalid/string-bad-escape.toml similarity index 100% rename from src/test/invalid/string-bad-escape.toml rename to tests/invalid/string-bad-escape.toml diff --git a/src/test/invalid/string-byte-escapes.toml b/tests/invalid/string-byte-escapes.toml similarity index 100% rename from src/test/invalid/string-byte-escapes.toml rename to tests/invalid/string-byte-escapes.toml diff --git a/src/test/invalid/string-no-close.toml b/tests/invalid/string-no-close.toml similarity index 100% rename from src/test/invalid/string-no-close.toml rename to tests/invalid/string-no-close.toml diff --git a/src/test/invalid/table-array-implicit.toml b/tests/invalid/table-array-implicit.toml similarity index 100% rename from src/test/invalid/table-array-implicit.toml rename to tests/invalid/table-array-implicit.toml diff --git a/src/test/invalid/table-array-malformed-bracket.toml b/tests/invalid/table-array-malformed-bracket.toml similarity index 100% rename from src/test/invalid/table-array-malformed-bracket.toml rename to tests/invalid/table-array-malformed-bracket.toml diff --git a/src/test/invalid/table-array-malformed-empty.toml b/tests/invalid/table-array-malformed-empty.toml similarity index 100% rename from src/test/invalid/table-array-malformed-empty.toml rename to tests/invalid/table-array-malformed-empty.toml diff --git a/src/test/invalid/table-nested-brackets-close.toml b/tests/invalid/table-nested-brackets-close.toml similarity index 100% rename from src/test/invalid/table-nested-brackets-close.toml rename to tests/invalid/table-nested-brackets-close.toml diff --git a/src/test/invalid/table-nested-brackets-open.toml b/tests/invalid/table-nested-brackets-open.toml similarity index 100% rename from src/test/invalid/table-nested-brackets-open.toml rename to tests/invalid/table-nested-brackets-open.toml diff --git a/src/test/invalid/text-after-array-entries.toml b/tests/invalid/text-after-array-entries.toml similarity index 100% rename from src/test/invalid/text-after-array-entries.toml rename to tests/invalid/text-after-array-entries.toml diff --git a/src/test/invalid/text-after-integer.toml b/tests/invalid/text-after-integer.toml similarity index 100% rename from src/test/invalid/text-after-integer.toml rename to tests/invalid/text-after-integer.toml diff --git a/src/test/invalid/text-after-string.toml b/tests/invalid/text-after-string.toml similarity index 100% rename from src/test/invalid/text-after-string.toml rename to tests/invalid/text-after-string.toml diff --git a/src/test/invalid/text-after-table.toml b/tests/invalid/text-after-table.toml similarity index 100% rename from src/test/invalid/text-after-table.toml rename to tests/invalid/text-after-table.toml diff --git a/src/test/invalid/text-before-array-separator.toml b/tests/invalid/text-before-array-separator.toml similarity index 100% rename from src/test/invalid/text-before-array-separator.toml rename to tests/invalid/text-before-array-separator.toml diff --git a/src/test/invalid/text-in-array.toml b/tests/invalid/text-in-array.toml similarity index 100% rename from src/test/invalid/text-in-array.toml rename to tests/invalid/text-in-array.toml diff --git a/src/test/valid.rs b/tests/valid.rs similarity index 96% rename from src/test/valid.rs rename to tests/valid.rs index 289fa24..6ff0d80 100644 --- a/src/test/valid.rs +++ b/tests/valid.rs @@ -1,11 +1,12 @@ -extern crate serialize; +extern crate "rustc-serialize" as rustc_serialize; +extern crate toml; use std::num::strconv; use std::collections::BTreeMap; -use self::serialize::json::{self, Json}; +use rustc_serialize::json::Json; -use {Parser, Value}; -use Value::{Table, Integer, Float, Boolean, Datetime, Array}; +use toml::{Parser, Value}; +use toml::Value::{Table, Integer, Float, Boolean, Datetime, Array}; fn to_json(toml: Value) -> Json { fn doit(s: &str, json: Json) -> Json { @@ -53,7 +54,7 @@ fn run(toml: &str, json: &str) { assert!(table.is_some()); let table = table.unwrap(); - let json = json::from_str(json).unwrap(); + let json = Json::from_str(json).unwrap(); let toml_json = to_json(Table(table)); assert!(json == toml_json, "expected\n{}\ngot\n{}\n", diff --git a/src/test/valid/array-empty.json b/tests/valid/array-empty.json similarity index 100% rename from src/test/valid/array-empty.json rename to tests/valid/array-empty.json diff --git a/src/test/valid/array-empty.toml b/tests/valid/array-empty.toml similarity index 100% rename from src/test/valid/array-empty.toml rename to tests/valid/array-empty.toml diff --git a/src/test/valid/array-nospaces.json b/tests/valid/array-nospaces.json similarity index 100% rename from src/test/valid/array-nospaces.json rename to tests/valid/array-nospaces.json diff --git a/src/test/valid/array-nospaces.toml b/tests/valid/array-nospaces.toml similarity index 100% rename from src/test/valid/array-nospaces.toml rename to tests/valid/array-nospaces.toml diff --git a/src/test/valid/arrays-hetergeneous.json b/tests/valid/arrays-hetergeneous.json similarity index 100% rename from src/test/valid/arrays-hetergeneous.json rename to tests/valid/arrays-hetergeneous.json diff --git a/src/test/valid/arrays-hetergeneous.toml b/tests/valid/arrays-hetergeneous.toml similarity index 100% rename from src/test/valid/arrays-hetergeneous.toml rename to tests/valid/arrays-hetergeneous.toml diff --git a/src/test/valid/arrays-nested.json b/tests/valid/arrays-nested.json similarity index 100% rename from src/test/valid/arrays-nested.json rename to tests/valid/arrays-nested.json diff --git a/src/test/valid/arrays-nested.toml b/tests/valid/arrays-nested.toml similarity index 100% rename from src/test/valid/arrays-nested.toml rename to tests/valid/arrays-nested.toml diff --git a/src/test/valid/arrays.json b/tests/valid/arrays.json similarity index 100% rename from src/test/valid/arrays.json rename to tests/valid/arrays.json diff --git a/src/test/valid/arrays.toml b/tests/valid/arrays.toml similarity index 100% rename from src/test/valid/arrays.toml rename to tests/valid/arrays.toml diff --git a/src/test/valid/bool.json b/tests/valid/bool.json similarity index 100% rename from src/test/valid/bool.json rename to tests/valid/bool.json diff --git a/src/test/valid/bool.toml b/tests/valid/bool.toml similarity index 100% rename from src/test/valid/bool.toml rename to tests/valid/bool.toml diff --git a/src/test/valid/comments-everywhere.json b/tests/valid/comments-everywhere.json similarity index 100% rename from src/test/valid/comments-everywhere.json rename to tests/valid/comments-everywhere.json diff --git a/src/test/valid/comments-everywhere.toml b/tests/valid/comments-everywhere.toml similarity index 100% rename from src/test/valid/comments-everywhere.toml rename to tests/valid/comments-everywhere.toml diff --git a/src/test/valid/datetime.json b/tests/valid/datetime.json similarity index 100% rename from src/test/valid/datetime.json rename to tests/valid/datetime.json diff --git a/src/test/valid/datetime.toml b/tests/valid/datetime.toml similarity index 100% rename from src/test/valid/datetime.toml rename to tests/valid/datetime.toml diff --git a/src/test/valid/empty.json b/tests/valid/empty.json similarity index 100% rename from src/test/valid/empty.json rename to tests/valid/empty.json diff --git a/src/test/valid/empty.toml b/tests/valid/empty.toml similarity index 100% rename from src/test/valid/empty.toml rename to tests/valid/empty.toml diff --git a/src/test/valid/example.json b/tests/valid/example.json similarity index 100% rename from src/test/valid/example.json rename to tests/valid/example.json diff --git a/src/test/valid/example.toml b/tests/valid/example.toml similarity index 100% rename from src/test/valid/example.toml rename to tests/valid/example.toml diff --git a/src/test/valid/float.json b/tests/valid/float.json similarity index 100% rename from src/test/valid/float.json rename to tests/valid/float.json diff --git a/src/test/valid/float.toml b/tests/valid/float.toml similarity index 100% rename from src/test/valid/float.toml rename to tests/valid/float.toml diff --git a/src/test/valid/implicit-and-explicit-after.json b/tests/valid/implicit-and-explicit-after.json similarity index 100% rename from src/test/valid/implicit-and-explicit-after.json rename to tests/valid/implicit-and-explicit-after.json diff --git a/src/test/valid/implicit-and-explicit-after.toml b/tests/valid/implicit-and-explicit-after.toml similarity index 100% rename from src/test/valid/implicit-and-explicit-after.toml rename to tests/valid/implicit-and-explicit-after.toml diff --git a/src/test/valid/implicit-and-explicit-before.json b/tests/valid/implicit-and-explicit-before.json similarity index 100% rename from src/test/valid/implicit-and-explicit-before.json rename to tests/valid/implicit-and-explicit-before.json diff --git a/src/test/valid/implicit-and-explicit-before.toml b/tests/valid/implicit-and-explicit-before.toml similarity index 100% rename from src/test/valid/implicit-and-explicit-before.toml rename to tests/valid/implicit-and-explicit-before.toml diff --git a/src/test/valid/implicit-groups.json b/tests/valid/implicit-groups.json similarity index 100% rename from src/test/valid/implicit-groups.json rename to tests/valid/implicit-groups.json diff --git a/src/test/valid/implicit-groups.toml b/tests/valid/implicit-groups.toml similarity index 100% rename from src/test/valid/implicit-groups.toml rename to tests/valid/implicit-groups.toml diff --git a/src/test/valid/integer.json b/tests/valid/integer.json similarity index 100% rename from src/test/valid/integer.json rename to tests/valid/integer.json diff --git a/src/test/valid/integer.toml b/tests/valid/integer.toml similarity index 100% rename from src/test/valid/integer.toml rename to tests/valid/integer.toml diff --git a/src/test/valid/key-equals-nospace.json b/tests/valid/key-equals-nospace.json similarity index 100% rename from src/test/valid/key-equals-nospace.json rename to tests/valid/key-equals-nospace.json diff --git a/src/test/valid/key-equals-nospace.toml b/tests/valid/key-equals-nospace.toml similarity index 100% rename from src/test/valid/key-equals-nospace.toml rename to tests/valid/key-equals-nospace.toml diff --git a/src/test/valid/key-special-chars.json b/tests/valid/key-special-chars.json similarity index 100% rename from src/test/valid/key-special-chars.json rename to tests/valid/key-special-chars.json diff --git a/src/test/valid/key-special-chars.toml b/tests/valid/key-special-chars.toml similarity index 100% rename from src/test/valid/key-special-chars.toml rename to tests/valid/key-special-chars.toml diff --git a/src/test/valid/key-with-pound.json b/tests/valid/key-with-pound.json similarity index 100% rename from src/test/valid/key-with-pound.json rename to tests/valid/key-with-pound.json diff --git a/src/test/valid/key-with-pound.toml b/tests/valid/key-with-pound.toml similarity index 100% rename from src/test/valid/key-with-pound.toml rename to tests/valid/key-with-pound.toml diff --git a/src/test/valid/long-float.json b/tests/valid/long-float.json similarity index 100% rename from src/test/valid/long-float.json rename to tests/valid/long-float.json diff --git a/src/test/valid/long-float.toml b/tests/valid/long-float.toml similarity index 100% rename from src/test/valid/long-float.toml rename to tests/valid/long-float.toml diff --git a/src/test/valid/long-integer.json b/tests/valid/long-integer.json similarity index 100% rename from src/test/valid/long-integer.json rename to tests/valid/long-integer.json diff --git a/src/test/valid/long-integer.toml b/tests/valid/long-integer.toml similarity index 100% rename from src/test/valid/long-integer.toml rename to tests/valid/long-integer.toml diff --git a/src/test/valid/string-empty.json b/tests/valid/string-empty.json similarity index 100% rename from src/test/valid/string-empty.json rename to tests/valid/string-empty.json diff --git a/src/test/valid/string-empty.toml b/tests/valid/string-empty.toml similarity index 100% rename from src/test/valid/string-empty.toml rename to tests/valid/string-empty.toml diff --git a/src/test/valid/string-escapes.json b/tests/valid/string-escapes.json similarity index 100% rename from src/test/valid/string-escapes.json rename to tests/valid/string-escapes.json diff --git a/src/test/valid/string-escapes.toml b/tests/valid/string-escapes.toml similarity index 100% rename from src/test/valid/string-escapes.toml rename to tests/valid/string-escapes.toml diff --git a/src/test/valid/string-simple.json b/tests/valid/string-simple.json similarity index 100% rename from src/test/valid/string-simple.json rename to tests/valid/string-simple.json diff --git a/src/test/valid/string-simple.toml b/tests/valid/string-simple.toml similarity index 100% rename from src/test/valid/string-simple.toml rename to tests/valid/string-simple.toml diff --git a/src/test/valid/string-with-pound.json b/tests/valid/string-with-pound.json similarity index 100% rename from src/test/valid/string-with-pound.json rename to tests/valid/string-with-pound.json diff --git a/src/test/valid/string-with-pound.toml b/tests/valid/string-with-pound.toml similarity index 100% rename from src/test/valid/string-with-pound.toml rename to tests/valid/string-with-pound.toml diff --git a/src/test/valid/table-array-implicit.json b/tests/valid/table-array-implicit.json similarity index 100% rename from src/test/valid/table-array-implicit.json rename to tests/valid/table-array-implicit.json diff --git a/src/test/valid/table-array-implicit.toml b/tests/valid/table-array-implicit.toml similarity index 100% rename from src/test/valid/table-array-implicit.toml rename to tests/valid/table-array-implicit.toml diff --git a/src/test/valid/table-array-many.json b/tests/valid/table-array-many.json similarity index 100% rename from src/test/valid/table-array-many.json rename to tests/valid/table-array-many.json diff --git a/src/test/valid/table-array-many.toml b/tests/valid/table-array-many.toml similarity index 100% rename from src/test/valid/table-array-many.toml rename to tests/valid/table-array-many.toml diff --git a/src/test/valid/table-array-nest.json b/tests/valid/table-array-nest.json similarity index 100% rename from src/test/valid/table-array-nest.json rename to tests/valid/table-array-nest.json diff --git a/src/test/valid/table-array-nest.toml b/tests/valid/table-array-nest.toml similarity index 100% rename from src/test/valid/table-array-nest.toml rename to tests/valid/table-array-nest.toml diff --git a/src/test/valid/table-array-one.json b/tests/valid/table-array-one.json similarity index 100% rename from src/test/valid/table-array-one.json rename to tests/valid/table-array-one.json diff --git a/src/test/valid/table-array-one.toml b/tests/valid/table-array-one.toml similarity index 100% rename from src/test/valid/table-array-one.toml rename to tests/valid/table-array-one.toml diff --git a/src/test/valid/table-empty.json b/tests/valid/table-empty.json similarity index 100% rename from src/test/valid/table-empty.json rename to tests/valid/table-empty.json diff --git a/src/test/valid/table-empty.toml b/tests/valid/table-empty.toml similarity index 100% rename from src/test/valid/table-empty.toml rename to tests/valid/table-empty.toml diff --git a/src/test/valid/table-sub-empty.json b/tests/valid/table-sub-empty.json similarity index 100% rename from src/test/valid/table-sub-empty.json rename to tests/valid/table-sub-empty.json diff --git a/src/test/valid/table-sub-empty.toml b/tests/valid/table-sub-empty.toml similarity index 100% rename from src/test/valid/table-sub-empty.toml rename to tests/valid/table-sub-empty.toml diff --git a/src/test/valid/table-whitespace.json b/tests/valid/table-whitespace.json similarity index 100% rename from src/test/valid/table-whitespace.json rename to tests/valid/table-whitespace.json diff --git a/src/test/valid/table-whitespace.toml b/tests/valid/table-whitespace.toml similarity index 100% rename from src/test/valid/table-whitespace.toml rename to tests/valid/table-whitespace.toml diff --git a/src/test/valid/table-with-pound.json b/tests/valid/table-with-pound.json similarity index 100% rename from src/test/valid/table-with-pound.json rename to tests/valid/table-with-pound.json diff --git a/src/test/valid/table-with-pound.toml b/tests/valid/table-with-pound.toml similarity index 100% rename from src/test/valid/table-with-pound.toml rename to tests/valid/table-with-pound.toml diff --git a/src/test/valid/unicode-escape.json b/tests/valid/unicode-escape.json similarity index 100% rename from src/test/valid/unicode-escape.json rename to tests/valid/unicode-escape.json diff --git a/src/test/valid/unicode-escape.toml b/tests/valid/unicode-escape.toml similarity index 100% rename from src/test/valid/unicode-escape.toml rename to tests/valid/unicode-escape.toml diff --git a/src/test/valid/unicode-literal.json b/tests/valid/unicode-literal.json similarity index 100% rename from src/test/valid/unicode-literal.json rename to tests/valid/unicode-literal.json diff --git a/src/test/valid/unicode-literal.toml b/tests/valid/unicode-literal.toml similarity index 100% rename from src/test/valid/unicode-literal.toml rename to tests/valid/unicode-literal.toml