2016-02-17 11:16:29 -06:00
|
|
|
#![feature(test, plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
#![deny(clippy, clippy_pedantic)]
|
2016-03-15 04:11:56 -05:00
|
|
|
|
2015-11-18 10:09:48 -06:00
|
|
|
extern crate compiletest_rs as compiletest;
|
2016-03-15 04:11:56 -05:00
|
|
|
extern crate test;
|
2015-11-18 10:09:48 -06:00
|
|
|
|
2016-02-17 11:16:29 -06:00
|
|
|
use std::env::{var, set_var};
|
2016-03-15 04:11:56 -05:00
|
|
|
use std::path::PathBuf;
|
|
|
|
use test::TestPaths;
|
2015-11-18 10:09:48 -06:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dogfood() {
|
|
|
|
let mut config = compiletest::default_config();
|
|
|
|
|
2016-02-17 11:16:29 -06:00
|
|
|
let cfg_mode = "run-pass".parse().expect("Invalid mode");
|
2015-11-18 10:09:48 -06:00
|
|
|
let mut s = String::new();
|
|
|
|
s.push_str(" -L target/debug/");
|
|
|
|
s.push_str(" -L target/debug/deps");
|
|
|
|
s.push_str(" -Zextra-plugins=clippy -Ltarget_recur/debug -Dclippy_pedantic -Dclippy");
|
|
|
|
config.target_rustcflags = Some(s);
|
2016-02-17 11:16:29 -06:00
|
|
|
if let Ok(name) = var("TESTNAME") {
|
|
|
|
config.filter = Some(name.to_owned())
|
2015-11-18 10:09:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
config.mode = cfg_mode;
|
|
|
|
|
2016-03-15 04:11:56 -05:00
|
|
|
let paths = TestPaths {
|
|
|
|
base: PathBuf::new(),
|
|
|
|
file: PathBuf::from("src/lib.rs"),
|
|
|
|
relative_dir: PathBuf::new(),
|
|
|
|
};
|
2016-02-17 11:16:29 -06:00
|
|
|
|
|
|
|
set_var("CLIPPY_DOGFOOD", "tastes like chicken");
|
|
|
|
|
2016-03-15 04:11:56 -05:00
|
|
|
compiletest::runtest::run(config, &paths);
|
2015-11-18 10:09:48 -06:00
|
|
|
}
|