1 extern crate compiletest_rs as compiletest;
3 use std::path::PathBuf;
4 use std::env::{set_var, var, temp_dir};
6 fn run_mode(dir: &'static str, mode: &'static str) {
7 let mut config = compiletest::default_config();
9 let cfg_mode = mode.parse().ok().expect("Invalid mode");
10 config.target_rustcflags = Some("-L target/debug/ -L target/debug/deps".to_owned());
11 if let Ok(name) = var::<&str>("TESTNAME") {
12 let s : String = name.to_owned();
13 config.filter = Some(s)
16 config.mode = cfg_mode;
18 // work around https://github.com/laumann/compiletest-rs/issues/35 on msvc windows
19 config.build_base = temp_dir();
21 config.src_base = PathBuf::from(format!("tests/{}", dir));
23 compiletest::run_tests(&config);
27 set_var("CLIPPY_DISABLE_WIKI_LINKS", "true");
31 #[cfg(not(feature = "test-regex_macros"))]
34 run_mode("run-pass", "run-pass");
35 run_mode("compile-fail", "compile-fail");
39 #[cfg(feature = "test-regex_macros")]
42 run_mode("run-pass-regex_macros", "run-pass");
43 run_mode("compile-fail-regex_macros", "compile-fail");