]> git.lizzy.rs Git - rust.git/blob - tests/compile-test.rs
Merge pull request #927 from oli-obk/german_windows_32bit
[rust.git] / tests / compile-test.rs
1 extern crate compiletest_rs as compiletest;
2
3 use std::path::PathBuf;
4 use std::env::{var, temp_dir};
5
6 fn run_mode(dir: &'static str, 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/ -L 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)
14     }
15
16     config.mode = cfg_mode;
17     if cfg!(windows) {
18         // work around https://github.com/laumann/compiletest-rs/issues/35 on msvc windows
19         config.build_base = temp_dir();
20     }
21     config.src_base = PathBuf::from(format!("tests/{}", dir));
22
23     compiletest::run_tests(&config);
24 }
25
26 #[test]
27 #[cfg(not(feature = "test-regex_macros"))]
28 fn compile_test() {
29     run_mode("run-pass", "run-pass");
30     run_mode("compile-fail", "compile-fail");
31 }
32
33 #[test]
34 #[cfg(feature = "test-regex_macros")]
35 fn compile_test() {
36     run_mode("run-pass-regex_macros", "run-pass");
37     run_mode("compile-fail-regex_macros", "compile-fail");
38 }