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

Commit 1c7202b

Browse files
committed
fix test_ignore_path_set test when run on beta
``` ---- ignore_path::test::test_ignore_path_set stdout ---- Warning: can't set `ignore = IgnoreList({"foo.rs", "bar_dir/*"})`, unstable features are only available in nightly channel. thread 'ignore_path::test::test_ignore_path_set' panicked at 'assertion failed: ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs")))', src/ignore_path.rs:51:9 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. failures: ignore_path::test::test_ignore_path_set ```
1 parent 31fbf34 commit 1c7202b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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)