feat: improve watch execution mode

The `watch` command now requires user action to move to the next
exercise.

BREAKING CHANGE: this changes the behavior of `watch`.
This commit is contained in:
Roberto Vidal
2019-11-11 13:38:24 +01:00
parent a47a62172a
commit 2cdd61294f
60 changed files with 309 additions and 12 deletions

View File

View File

@@ -0,0 +1,7 @@
// fake_exercise
// I AM NOT DONE
fn main() {
}

View File

@@ -1,4 +1,7 @@
use assert_cmd::prelude::*;
use glob::glob;
use std::fs::File;
use std::io::Read;
use std::process::Command;
#[test]
@@ -105,3 +108,20 @@ fn run_single_test_no_exercise() {
.assert()
.code(1);
}
#[test]
fn all_exercises_require_confirmation() {
for exercise in glob("exercises/**/*.rs").unwrap() {
let path = exercise.unwrap();
let source = {
let mut file = File::open(&path).unwrap();
let mut s = String::new();
file.read_to_string(&mut s).unwrap();
s
};
source.matches("// I AM NOT DONE").next().expect(&format!(
"There should be an `I AM NOT DONE` annotation in {:?}",
path
));
}
}