@@ -1,24 +1,26 @@
1−#![cfg(test)]
1+fn main() {}
3−extern crate compiletest_rs as compiletest;
5+ extern crate compiletest_rs as compiletest;
6+ use std::path::PathBuf;
5−use std::path::PathBuf;
8+ fn run_mode(mode: &'static str) {
9+ let mut config = self::compiletest::Config::default();
7−fn run_mode(mode: &'static str) {
11+ config.mode = mode.parse().expect("Invalid mode");
8− let mut config = compiletest::Config::default();
12+ config.src_base = PathBuf::from(format!("{}", mode));
10− config.mode = mode.parse().expect("Invalid mode");
14+ // Populate config.target_rustcflags with dependencies on the path.
11− config.src_base = PathBuf::from(format!("{}", mode));
15+ config.link_deps();
16+ // If your tests import the parent crate, this helps with E0464
17+ config.clean_rmeta();
13− // Populate config.target_rustcflags with dependencies on the path.
19+ compiletest::run_tests(&config);
14− config.link_deps();
20+ }
15− // If your tests import the parent crate, this helps with E0464
16− config.clean_rmeta();
18− compiletest::run_tests(&config);
22−fn compile_test() {
23+ fn compile_test() {
23− run_mode("compile-fail");
24+ run_mode("compile-fail");