From 4b26546589f7d2b50455429482cf1f386ceae8b3 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Tue, 12 Nov 2019 11:35:40 +0100 Subject: fix(run): makes `run` never prompt `watch` and `verify` do prompt the user to actively move to the next exercise. This change fixes `run` to never prompt. Previously it was inconsistent between "test" and "compile" exercises. BREAKING CHANGE: we again change the behavior of the `run` command --- tests/fixture/state/finished_exercise.rs | 5 +++++ tests/fixture/state/info.toml | 11 +++++++++++ tests/fixture/state/pending_test_exercise.rs | 4 ++++ tests/integration_tests.rs | 23 +++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 tests/fixture/state/info.toml create mode 100644 tests/fixture/state/pending_test_exercise.rs (limited to 'tests') diff --git a/tests/fixture/state/finished_exercise.rs b/tests/fixture/state/finished_exercise.rs index e69de29..016b827 100644 --- a/tests/fixture/state/finished_exercise.rs +++ b/tests/fixture/state/finished_exercise.rs @@ -0,0 +1,5 @@ +// fake_exercise + +fn main() { + +} diff --git a/tests/fixture/state/info.toml b/tests/fixture/state/info.toml new file mode 100644 index 0000000..7bfc697 --- /dev/null +++ b/tests/fixture/state/info.toml @@ -0,0 +1,11 @@ +[[exercises]] +name = "pending_exercise" +path = "pending_exercise.rs" +mode = "compile" +hint = """""" + +[[exercises]] +name = "pending_test_exercise" +path = "pending_test_exercise.rs" +mode = "test" +hint = """""" diff --git a/tests/fixture/state/pending_test_exercise.rs b/tests/fixture/state/pending_test_exercise.rs new file mode 100644 index 0000000..8756f02 --- /dev/null +++ b/tests/fixture/state/pending_test_exercise.rs @@ -0,0 +1,4 @@ +// I AM NOT DONE + +#[test] +fn it_works() {} diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 754aa63..7131700 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1,5 +1,6 @@ use assert_cmd::prelude::*; use glob::glob; +use predicates::boolean::PredicateBooleanExt; use std::fs::File; use std::io::Read; use std::process::Command; @@ -136,3 +137,25 @@ fn all_exercises_require_confirmation() { )); } } + +#[test] +fn run_compile_exercise_does_not_prompt() { + Command::cargo_bin("rustlings") + .unwrap() + .args(&["r", "pending_exercise"]) + .current_dir("tests/fixture/state") + .assert() + .code(0) + .stdout(predicates::str::contains("I AM NOT DONE").not()); +} + +#[test] +fn run_test_exercise_does_not_prompt() { + Command::cargo_bin("rustlings") + .unwrap() + .args(&["r", "pending_test_exercise"]) + .current_dir("tests/fixture/state") + .assert() + .code(0) + .stdout(predicates::str::contains("I AM NOT DONE").not()); +} -- cgit v1.2.3