-
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.
Enforce documentation of additional tests (#1817)
- Loading branch information
Showing
8 changed files
with
70 additions
and
0 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
22 changes: 22 additions & 0 deletions
22
rust-tooling/ci-tests/tests/additional_tests_are_documented.rs
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use glob::glob; | ||
use models::problem_spec::SingleTestCase; | ||
use utils::fs::cd_into_repo_root; | ||
|
||
#[test] | ||
fn additional_tests_are_documented() { | ||
cd_into_repo_root(); | ||
for entry in glob("exercises/*/*/.meta/additional-tests.json").unwrap() { | ||
let path = entry.unwrap(); | ||
let f = std::fs::File::open(&path).unwrap(); | ||
let reader = std::io::BufReader::new(f); | ||
let test_cases: Vec<SingleTestCase> = serde_json::from_reader(reader).unwrap(); | ||
|
||
for case in test_cases { | ||
assert!( | ||
!case.comments.unwrap_or_default().is_empty(), | ||
"missing documentation for additional tests in {}", | ||
path.display() | ||
); | ||
} | ||
} | ||
} |