1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-11-29 22:47:43 +02:00

Merge branch 'master' into refactor-hints

This commit is contained in:
marisa
2019-11-11 17:21:06 +01:00
committed by GitHub
61 changed files with 315 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]
@@ -115,4 +118,20 @@ fn get_hint_for_single_test() {
.assert()
.code(0)
.stdout("Hello!\n");
#[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
));
}
}