From 4b9cd06d864a4f4ff8d9d4f69991da70a8b0b35e Mon Sep 17 00:00:00 2001 From: David Peter Date: Thu, 20 Apr 2023 13:06:36 +0200 Subject: [PATCH] Add regression test for #642 --- tests/integration_tests.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 6e503ec..7930d8d 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -361,3 +361,24 @@ fn intermediate_results_are_not_exported_to_stdout() { .and(predicate::str::contains("sleep 2").count(1)), ); } + +#[test] +#[cfg(unix)] +fn exports_intermediate_results_to_file() { + use tempfile::tempdir; + + let tempdir = tempdir().unwrap(); + let export_path = tempdir.path().join("results.md"); + + hyperfine() + .arg("--runs=1") + .arg("--export-markdown") + .arg(&export_path) + .arg("true") + .arg("false") + .assert() + .failure(); + + let contents = std::fs::read_to_string(export_path).unwrap(); + assert!(contents.contains("true")); +}