]> git.lizzy.rs Git - rust.git/blob - tests/compile-test.rs
Add new lint on function naming check (the '_')
[rust.git] / tests / compile-test.rs
1 extern crate compiletest_rs as compiletest;
2
3 use std::path::PathBuf;
4 use std::env::var;
5
6 fn run_mode(mode: &'static str) {
7     let mut config = compiletest::default_config();
8
9     let cfg_mode = mode.parse().ok().expect("Invalid mode");
10     config.target_rustcflags = Some("-L target/debug/".to_owned());
11     if let Ok(name) = var::<&str>("TESTNAME") {
12         let s : String = name.to_owned();
13         config.filter = Some(s)
14     }
15
16     config.mode = cfg_mode;
17     config.src_base = PathBuf::from(format!("tests/{}", mode));
18
19     compiletest::run_tests(&config);
20 }
21
22 #[test]
23 fn compile_test() {
24     run_mode("compile-fail");
25 }