Simplify compiletest setup
This commit is contained in:
parent
6b33abb179
commit
b3d9d51b51
@ -10,22 +10,14 @@
|
||||
|
||||
extern crate compiletest_rs as compiletest;
|
||||
|
||||
use std::env;
|
||||
|
||||
fn run_mode(mode: &'static str) {
|
||||
let mut config = compiletest::Config::default();
|
||||
|
||||
config.mode = mode.parse().expect("invalid mode");
|
||||
config.target_rustcflags = Some("-L deps/target/debug/deps".to_owned());
|
||||
if let Ok(name) = env::var("TESTNAME") {
|
||||
config.filter = Some(name);
|
||||
}
|
||||
config.src_base = format!("tests/{}", mode).into();
|
||||
#[test]
|
||||
fn compile_fail() {
|
||||
let config = compiletest::Config {
|
||||
mode: compiletest::common::Mode::CompileFail,
|
||||
src_base: std::path::PathBuf::from("tests/compile-fail"),
|
||||
target_rustcflags: Some("-L deps/target/debug/deps".to_owned()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
compiletest::run_tests(&config);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compile_fail() {
|
||||
run_mode("compile-fail");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user