Skip to content

Commit

Permalink
Improved timeout test
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcefrog committed Dec 11, 2023
1 parent fcbe438 commit 33845ba
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::borrow::Borrow;
use std::env;
use std::fmt::Write;
use std::fs::{self, read_dir};
use std::fs::{self, read_dir, read_to_string};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::thread::sleep;
Expand Down Expand Up @@ -1114,7 +1114,18 @@ fn mutants_causing_tests_to_hang_are_stopped_by_manual_timeout() {
.stdout(contains(
"replace controlled_loop -> usize with 0 ... caught",
));
// TODO: Inspect outcomes.json.
let timeout_txt = read_to_string(tmp_src_dir.path().join("mutants.out/timeout.txt"))
.expect("read timeout.txt");
assert!(
timeout_txt.contains("replace should_stop"),
"expected text not found in:\n{timeout_txt}"
);
let outcomes_json: serde_json::Value =
read_to_string(tmp_src_dir.path().join("mutants.out/outcomes.json"))
.expect("read outcomes.json")
.parse()
.expect("parse outcomes.json");
assert_eq!(outcomes_json["timeout"], 1);
}

#[test]
Expand Down

0 comments on commit 33845ba

Please sign in to comment.