Skip to content

Commit d6073eb

Browse files
committed
Fix regex tests
1 parent a878916 commit d6073eb

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ script:
1313
- rm -rf target/ Cargo.lock
1414
- cargo test --features debugging
1515

16-
# only test regex_macros if it compiles
17-
- if [[ "$(cargo build --features 'debugging test-regex_macros')" = 101 ]]; then cargo test --features 'debugging test-regex_macros'; fi
16+
- # only test regex_macros if it compiles
17+
- |
18+
#!/bin/bash
19+
cargo test --no-run --features 'debugging test-regex_macros'
20+
if [ "$?" = 101 ]; then
21+
cargo test --features 'debugging test-regex_macros'
22+
fi
1823
1924
# trigger rebuild of the clippy-service, to keep it up to date with clippy itself
2025
after_success:

tests/compile-test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern crate compiletest_rs as compiletest;
33
use std::path::PathBuf;
44
use std::env::var;
55

6-
fn run_mode(mode: &'static str) {
6+
fn run_mode(dir: &'static str, mode: &'static str) {
77
let mut config = compiletest::default_config();
88

99
let cfg_mode = mode.parse().ok().expect("Invalid mode");
@@ -14,21 +14,21 @@ fn run_mode(mode: &'static str) {
1414
}
1515

1616
config.mode = cfg_mode;
17-
config.src_base = PathBuf::from(format!("tests/{}", mode));
17+
config.src_base = PathBuf::from(format!("tests/{}", dir));
1818

1919
compiletest::run_tests(&config);
2020
}
2121

2222
#[test]
2323
#[cfg(not(feature = "test-regex_macros"))]
2424
fn compile_test() {
25-
run_mode("run-pass");
26-
run_mode("compile-fail");
25+
run_mode("run-pass", "run-pass");
26+
run_mode("compile-fail", "compile-fail");
2727
}
2828

2929
#[test]
3030
#[cfg(feature = "test-regex_macros")]
3131
fn compile_test() {
32-
run_mode("run-pass-regex_macros");
33-
run_mode("compile-fail-regex_macros");
32+
run_mode("run-pass-regex_macros", "run-pass");
33+
run_mode("compile-fail-regex_macros", "compile-fail");
3434
}

0 commit comments

Comments
 (0)