diff --git a/examples/rust_lang_tester/lang_tests/ignore2.rs b/examples/rust_lang_tester/lang_tests/ignore2.rs new file mode 100644 index 0000000..18dbd85 --- /dev/null +++ b/examples/rust_lang_tester/lang_tests/ignore2.rs @@ -0,0 +1,8 @@ +// # Always ignore this test +// ignore-if: cat examples/rust_lang_tester/lang_tests/ignore.rs +// Compiler: +// status: success + +fn main() { + panic!("Shouldn't happen."); +} diff --git a/examples/rust_lang_tester/lang_tests/no_main.rs b/examples/rust_lang_tester/lang_tests/no_main.rs index 50eb9be..aacc239 100644 --- a/examples/rust_lang_tester/lang_tests/no_main.rs +++ b/examples/rust_lang_tester/lang_tests/no_main.rs @@ -3,6 +3,6 @@ // stderr: // error[E0601]: `main` function not found in crate `no_main` // ... -// error: aborting due to previous error +// error: aborting due to 1 previous error // // For more information about this error, try `rustc --explain E0601`. diff --git a/src/lib.rs b/src/lib.rs index 08475df..ffd6033 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,6 +165,7 @@ //! //! * `ignore-if: ` defines a shell command that will be run to determine whether to ignore //! this test or not. If `` returns 0 the test will be ignored, otherwise it will be run. +//! `` will have its directory set to `CARGO_MANIFEST_DIR`. //! //! `lang_tester`'s output is deliberately similar to Rust's normal testing output. Running the //! example `rust_lang_tester` in this crate produces the following output: diff --git a/src/tester.rs b/src/tester.rs index 88d9f43..066305a 100644 --- a/src/tester.rs +++ b/src/tester.rs @@ -659,6 +659,7 @@ fn test_file( let ignore = if let Some(ignore_if) = tests.ignore_if { Command::new(env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned())) .args(["-c", &ignore_if]) + .current_dir(env::var("CARGO_MANIFEST_DIR").unwrap()) .stdin(process::Stdio::piped()) .stderr(process::Stdio::piped()) .stdout(process::Stdio::piped())