aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--.travis.yml1
-rw-r--r--Cargo.toml3
-rw-r--r--serde-tests/Cargo.toml21
-rw-r--r--serde-tests/build.rs17
-rw-r--r--serde-tests/lib.rs1
-rw-r--r--serde-tests/test.rs1
-rw-r--r--serde-tests/test.rs.in (renamed from tests/serde.rs)9
8 files changed, 46 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 4fffb2f..a9d37c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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:
diff --git a/Cargo.toml b/Cargo.toml
index d935053..92d004e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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) }