Skip to content

Commit

Permalink
Extract Console::discovered_mutants
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcefrog committed Sep 21, 2022
1 parent dd0a853 commit dd90b4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ impl Console {
));
}

/// Update that we discovered some mutants to test.
pub fn discovered_mutants(&self, mutants: &[Mutant]) {
self.message(&format!(
"Found {} to test\n",
plural(mutants.len(), "mutant")
));
}

/// Update that work is starting on testing a given number of mutants.
pub fn start_testing_mutants(&self, n_mutants: usize) {
self.view.update(|model| {
Expand Down
7 changes: 2 additions & 5 deletions src/lab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tracing::error;
use tracing::{debug, info};

use crate::cargo::{cargo_argv, run_cargo, CargoSourceTree};
use crate::console::{plural, Console};
use crate::console::Console;
use crate::outcome::{LabOutcome, Phase, ScenarioOutcome};
use crate::output::OutputDir;
use crate::*;
Expand Down Expand Up @@ -42,10 +42,7 @@ pub fn test_unmutated_then_all_mutants(
mutants.shuffle(&mut rand::thread_rng());
}
output_dir.write_mutants_list(&mutants)?;
console.message(&format!(
"Found {} to test\n",
plural(mutants.len(), "mutant")
));
console.discovered_mutants(&mutants);
if mutants.is_empty() {
return Err(anyhow!("No mutants found"));
}
Expand Down

0 comments on commit dd90b4d

Please sign in to comment.