rustlings/tests/project_consistency.rs
2020-10-26 22:55:27 +01:00

21 lines
549 B
Rust

use glob::glob;
use std::fs;
use std::path::PathBuf;
#[test]
fn all_exercises_require_confirmation() {
for path in all_exercises() {
let source = fs::read_to_string(&path).unwrap();
source.matches("// I AM NOT DONE").next().expect(&format!(
"There should be an `I AM NOT DONE` annotation in {:?}",
path
));
}
}
fn all_exercises() -> impl Iterator<Item = PathBuf> {
glob("exercises/**/*.rs")
.unwrap()
.map(|result| result.expect("Unable to traverse exercises folder"))
}