Make serde-tests a standalone crate

This commit is contained in:
Alex Crichton 2015-06-11 01:34:08 -07:00
parent 85cd6f3e6e
commit f011b01051
8 changed files with 46 additions and 11 deletions

4
.gitignore vendored
View file

@ -1,2 +1,2 @@
/target
/Cargo.lock
target
Cargo.lock

View file

@ -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:

View file

@ -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 = "*"

21
serde-tests/Cargo.toml Normal file
View file

@ -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"

17
serde-tests/build.rs Normal file
View file

@ -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();
}

1
serde-tests/lib.rs Normal file
View file

@ -0,0 +1 @@
// intentionally blank

1
serde-tests/test.rs Normal file
View file

@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/test.rs"));

View file

@ -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) }