diff options
author | Alex Crichton <alex@alexcrichton.com> | 2015-06-11 01:34:08 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2015-08-13 09:39:49 -0700 |
commit | f011b0105189af7c131b257a210b5eb49c84ba1a (patch) | |
tree | c8e487b8513afb04c52e31a77b60d3a1ebe06f15 | |
parent | 85cd6f3e6ecabf6bbd465375a948e09581b98b1d (diff) | |
download | milf-rs-f011b0105189af7c131b257a210b5eb49c84ba1a.tar.gz milf-rs-f011b0105189af7c131b257a210b5eb49c84ba1a.zip |
Make serde-tests a standalone crate
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | serde-tests/Cargo.toml | 21 | ||||
-rw-r--r-- | serde-tests/build.rs | 17 | ||||
-rw-r--r-- | serde-tests/lib.rs | 1 | ||||
-rw-r--r-- | serde-tests/test.rs | 1 | ||||
-rw-r--r-- | serde-tests/test.rs.in (renamed from tests/serde.rs) | 9 |
8 files changed, 46 insertions, 11 deletions
@@ -1,2 +1,2 @@ -/target -/Cargo.lock +target +Cargo.lock diff --git a/.travis.yml b/.travis.yml index 417e85d..7866398 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ script: - cargo build --verbose --no-default-features - cargo build --verbose --features serde --no-default-features - cargo test --verbose --features serde + - cargo test --verbose --manifest-path serde-tests/Cargo.toml - rustdoc --test README.md -L target - cargo doc --no-deps after_success: @@ -17,11 +17,10 @@ facilitate deserializing and serializing Rust structures. [dependencies] rustc-serialize = { optional = true, version = "0.3.0" } -serde = { optional = true } +serde = { optional = true, version = "0.5" } [features] default = ["rustc-serialize"] [dev-dependencies] rustc-serialize = "0.3" -serde_macros = "*" diff --git a/serde-tests/Cargo.toml b/serde-tests/Cargo.toml new file mode 100644 index 0000000..e2f5a87 --- /dev/null +++ b/serde-tests/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "serde-tests" +version = "0.1.0" +authors = ["Alex Crichton <alex@alexcrichton.com>"] +build = "build.rs" + +[dependencies] +serde = "0.5" +toml = { path = "..", features = ["serde"] } + +[build-dependencies] +syntex = "0.7" +serde_codegen = "0.5" + +[lib] +name = "serde_tests" +path = "lib.rs" + +[[test]] +name = "serde" +path = "test.rs" diff --git a/serde-tests/build.rs b/serde-tests/build.rs new file mode 100644 index 0000000..7acbef5 --- /dev/null +++ b/serde-tests/build.rs @@ -0,0 +1,17 @@ +extern crate syntex; +extern crate serde_codegen; + +use std::env; +use std::path::Path; + +fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("test.rs.in"); + let dst = Path::new(&out_dir).join("test.rs"); + + let mut registry = syntex::Registry::new(); + + serde_codegen::register(&mut registry); + registry.expand("", &src, &dst).unwrap(); +} diff --git a/serde-tests/lib.rs b/serde-tests/lib.rs new file mode 100644 index 0000000..65e2cc3 --- /dev/null +++ b/serde-tests/lib.rs @@ -0,0 +1 @@ +// intentionally blank diff --git a/serde-tests/test.rs b/serde-tests/test.rs new file mode 100644 index 0000000..e8de9fa --- /dev/null +++ b/serde-tests/test.rs @@ -0,0 +1 @@ +include!(concat!(env!("OUT_DIR"), "/test.rs")); diff --git a/tests/serde.rs b/serde-tests/test.rs.in index f4af529..41ec27a 100644 --- a/tests/serde.rs +++ b/serde-tests/test.rs.in @@ -1,8 +1,3 @@ -#![cfg(feature = "serde")] -#![feature(custom_derive, plugin)] -#![plugin(serde_macros)] - - extern crate serde; extern crate toml; @@ -308,8 +303,8 @@ fn parse_enum() { } let v = Foo { a: E::Bar(10) }; - // technically serde is correct here. a single element tuple still is a tuple and therefor - // a sequence + // technically serde is correct here. a single element tuple still is a + // tuple and therefor a sequence assert_eq!( encode!(v), map! { a, Integer(10) } |