1 extern crate compiletest_rs as compiletest;
3 use std::path::PathBuf;
4 use std::env::{set_var, var};
6 fn run_mode(dir: &'static str, mode: &'static str) {
7 let mut config = compiletest::default_config();
9 let cfg_mode = mode.parse().expect("Invalid mode");
10 config.target_rustcflags = Some("-L clippy_tests/target/debug/ -L clippy_tests/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;
17 config.build_base = PathBuf::from("clippy_tests/target/debug/test_build_base");
18 config.src_base = PathBuf::from(format!("tests/{}", dir));
20 compiletest::run_tests(&config);
24 set_var("CLIPPY_DISABLE_WIKI_LINKS", "true");
30 run_mode("run-pass", "run-pass");
32 #[cfg(target_os = "windows")]
33 run_mode("ui-windows", "ui");
34 #[cfg(not(target_os = "windows"))]
35 run_mode("ui-posix", "ui");