Add run-pass test for expansion info

This commit is contained in:
David Tolnay 2016-07-04 14:49:50 -07:00
parent 149c87d7c2
commit a3a7e4085f
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
3 changed files with 19 additions and 1 deletions

View File

@ -21,6 +21,7 @@ clippy = { version = "^0.*", optional = true }
serde_codegen = { version = "^0.7.12", path = "../serde_codegen", default-features = false, features = ["nightly"] }
[dev-dependencies]
clippy = "^0.0.78"
compiletest_rs = "^0.2.0"
fnv = "1.0"
rustc-serialize = "^0.3.16"

View File

@ -20,6 +20,11 @@ fn run_mode(mode: &'static str) {
}
#[test]
fn compile_test() {
fn compile_fail() {
run_mode("compile-fail");
}
#[test]
fn run_pass() {
run_mode("run-pass");
}

View File

@ -0,0 +1,12 @@
#![feature(custom_derive, plugin)]
#![plugin(serde_macros, clippy)]
#![deny(identity_op)]
// The derived implementation uses 0+1 to add up the number of fields
// serialized, which Clippy warns about. If the expansion info is registered
// correctly, the Clippy lint is not triggered.
#[derive(Serialize)]
struct A { b: u8 }
fn main() {}