-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused ignore-count-ignores (#1968)
After having removed all macro-based testing, this is no longer needed.
- Loading branch information
Showing
5 changed files
with
14 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,17 @@ | ||
use models::exercise_config::{ | ||
get_all_concept_exercise_paths, get_all_practice_exercise_paths, PracticeExercise, | ||
}; | ||
|
||
fn assert_one_less_ignore_than_tests(path: &str) { | ||
let slug = path.split('/').last().unwrap(); | ||
let test_path = format!("{path}/tests/{slug}.rs"); | ||
let test_contents = std::fs::read_to_string(test_path).unwrap(); | ||
let num_tests = test_contents.matches("#[test]").count(); | ||
let num_ignores = test_contents.matches("#[ignore]").count(); | ||
assert_eq!( | ||
num_tests, | ||
num_ignores + 1, | ||
"should have one more test than ignore in {slug}" | ||
) | ||
} | ||
use models::exercise_config::get_all_exercise_paths; | ||
|
||
#[test] | ||
fn count_ignores() { | ||
for path in get_all_concept_exercise_paths() { | ||
assert_one_less_ignore_than_tests(&path); | ||
} | ||
for path in get_all_practice_exercise_paths() { | ||
let config_path = format!("{path}/.meta/config.json"); | ||
let config_contents = std::fs::read_to_string(config_path).unwrap(); | ||
let config: PracticeExercise = serde_json::from_str(config_contents.as_str()).unwrap(); | ||
if let Some(custom) = config.custom { | ||
if custom.ignore_count_ignores.unwrap_or_default() { | ||
continue; | ||
} | ||
} | ||
assert_one_less_ignore_than_tests(&path); | ||
for path in get_all_exercise_paths() { | ||
let slug = path.split('/').last().unwrap(); | ||
let test_path = format!("{path}/tests/{slug}.rs"); | ||
let test_contents = std::fs::read_to_string(test_path).unwrap(); | ||
let num_tests = test_contents.matches("#[test]").count(); | ||
let num_ignores = test_contents.matches("#[ignore]").count(); | ||
assert_eq!( | ||
num_tests, | ||
num_ignores + 1, | ||
"should have one more test than ignore in {slug}" | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters