Skip to content

Commit 7fc4e41

Browse files
committed
Tweak test settings
1 parent d0e96ed commit 7fc4e41

File tree

3 files changed

+20
-1
lines changed
  • src/test
  • tests
    • source/configs/skip_children/foo
    • target/configs/skip_children/foo

3 files changed

+20
-1
lines changed

src/test/mod.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ use crate::{FormatReport, Input, Session};
1717
const DIFF_CONTEXT_SIZE: usize = 3;
1818
const CONFIGURATIONS_FILE_NAME: &str = "Configurations.md";
1919

20+
// A list of files on which we want to skip testing.
21+
const SKIP_FILE_WHITE_LIST: &[&str] = &[
22+
// We want to make sure that the `skip_children` is correctly working,
23+
// so we do not want to test this file directly.
24+
"configs/skip_children/foo/mod.rs",
25+
];
26+
27+
fn is_file_skip(path: &Path) -> bool {
28+
SKIP_FILE_WHITE_LIST
29+
.iter()
30+
.any(|file_path| path.ends_with(file_path))
31+
}
32+
2033
// Returns a `Vec` containing `PathBuf`s of files with an `rs` extension in the
2134
// given path. The `recursive` argument controls if files from subdirectories
2235
// are also returned.
@@ -31,7 +44,7 @@ fn get_test_files(path: &Path, recursive: bool) -> Vec<PathBuf> {
3144
let path = entry.path();
3245
if path.is_dir() && recursive {
3346
files.append(&mut get_test_files(&path, recursive));
34-
} else if path.extension().map_or(false, |f| f == "rs") {
47+
} else if path.extension().map_or(false, |f| f == "rs") && !is_file_skip(&path) {
3548
files.push(path);
3649
}
3750
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn skip_formatting_this() {
2+
println ! ( "Skip this" ) ;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn skip_formatting_this() {
2+
println ! ( "Skip this" ) ;
3+
}

0 commit comments

Comments
 (0)