diff options
| author | Abdou Seck <djily02016@gmail.com> | 2020-06-04 10:31:17 -0400 |
|---|---|---|
| committer | Abdou Seck <djily02016@gmail.com> | 2020-06-04 11:18:26 -0400 |
| commit | 8ad5f9bf531a4848b1104b7b389a20171624c82f (patch) | |
| tree | 331c5d3725140b07d836ed8be6df30c8ddfd63fb /src/run.rs | |
| parent | 02a2fe48714a4546b28d38fb611e6bfce9f43cf6 (diff) | |
feat: Add a --nocapture option to display test harnesses' outputs
This new feature can be accessed by invoking rustlings with --nocapture.
Both unit and integration tests added.
closes #262
BREAKING CHANGES:
The following function take a new boolean argument:
* `run`
* `verify`
* `test`
* `compile_and_test`
Diffstat (limited to 'src/run.rs')
| -rw-r--r-- | src/run.rs | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -2,15 +2,22 @@ use crate::exercise::{Exercise, Mode}; use crate::verify::test; use indicatif::ProgressBar; -pub fn run(exercise: &Exercise) -> Result<(), ()> { +// Invoke the rust compiler on the path of the given exercise, +// and run the ensuing binary. +// The verbose argument helps determine whether or not to show +// the output from the test harnesses (if the mode of the exercise is test) +pub fn run(exercise: &Exercise, verbose: bool) -> Result<(), ()> { match exercise.mode { - Mode::Test => test(exercise)?, + Mode::Test => test(exercise, verbose)?, Mode::Compile => compile_and_run(exercise)?, Mode::Clippy => compile_and_run(exercise)?, } Ok(()) } +// Invoke the rust compiler on the path of the given exercise +// and run the ensuing binary. +// This is strictly for non-test binaries, so output is displayed fn compile_and_run(exercise: &Exercise) -> Result<(), ()> { let progress_bar = ProgressBar::new_spinner(); progress_bar.set_message(format!("Compiling {}...", exercise).as_str()); |
