Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit efa3a62

Browse files
authored
Merge pull request rust-lang#3512 from scampi/issue-2724
exit integration test successfully if the crate build failed before applying rustfmt
2 parents d0df47f + 1c7202b commit efa3a62

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

ci/integration.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ function check_fmt_with_lib_tests {
4242

4343
function check_fmt_base {
4444
local test_args="$1"
45-
cargo test $test_args
46-
if [[ $? != 0 ]]; then
45+
local build=$(cargo test $test_args 2>&1)
46+
if [[ "$build" =~ "build failed" ]] || [[ "$build" =~ "test result: FAILED." ]]; then
4747
return 0
4848
fi
4949
touch rustfmt.toml

src/ignore_path.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ mod test {
3939

4040
#[test]
4141
fn test_ignore_path_set() {
42-
let config = Config::from_toml(
43-
"ignore = [
44-
\"foo.rs\",
45-
\"bar_dir/*\",
46-
]",
47-
)
48-
.unwrap();
49-
let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap();
50-
51-
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs"))));
52-
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("bar_dir/baz.rs"))));
53-
assert!(!ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/bar.rs"))));
42+
match option_env!("CFG_RELEASE_CHANNEL") {
43+
// this test requires nightly
44+
None | Some("nightly") => {
45+
let config = Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#).unwrap();
46+
let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap();
47+
48+
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs"))));
49+
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("bar_dir/baz.rs"))));
50+
assert!(!ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/bar.rs"))));
51+
}
52+
_ => (),
53+
};
5454
}
5555
}

0 commit comments

Comments
 (0)