From 648246acf339a0399d4cb096c4f844df0ee27ab5 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 11 Feb 2026 17:52:26 +0000 Subject: [PATCH 1/3] Add shrunken value to stderr output --- .../test_runner/failure_persistence/file.rs | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/proptest/src/test_runner/failure_persistence/file.rs b/proptest/src/test_runner/failure_persistence/file.rs index 721f8cb8..156373e3 100644 --- a/proptest/src/test_runner/failure_persistence/file.rs +++ b/proptest/src/test_runner/failure_persistence/file.rs @@ -155,10 +155,12 @@ impl FailurePersistence for FileFailurePersistence { "proptest: Saving this and future failures in {}\n\ proptest: If this test was run on a CI system, you may \ wish to add the following line to your copy of the file.{}\n\ - {}", + {} # shrinks to {:?}", path.display(), if is_new { " (You may need to create it.)" } else { "" }, - seed); + seed, + shrunken_value + ); } } } @@ -421,20 +423,21 @@ mod tests { misplaced_file: PathBuf, } - static TEST_PATHS: std::sync::LazyLock = std::sync::LazyLock::new(|| { - let crate_root = Path::new(env!("CARGO_MANIFEST_DIR")); - let lib_root = crate_root.join("src"); - let src_subdir = lib_root.join("strategy"); - let src_file = lib_root.join("foo.rs"); - let subdir_file = src_subdir.join("foo.rs"); - let misplaced_file = crate_root.join("foo.rs"); - TestPaths { - crate_root, - src_file, - subdir_file, - misplaced_file, - } - }); + static TEST_PATHS: std::sync::LazyLock = + std::sync::LazyLock::new(|| { + let crate_root = Path::new(env!("CARGO_MANIFEST_DIR")); + let lib_root = crate_root.join("src"); + let src_subdir = lib_root.join("strategy"); + let src_file = lib_root.join("foo.rs"); + let subdir_file = src_subdir.join("foo.rs"); + let misplaced_file = crate_root.join("foo.rs"); + TestPaths { + crate_root, + src_file, + subdir_file, + misplaced_file, + } + }); #[test] fn persistence_file_location_resolved_correctly() { @@ -498,7 +501,8 @@ mod tests { #[test] fn relative_source_files_absolutified() { const TEST_RUNNER_PATH: &[&str] = &["src", "test_runner", "mod.rs"]; - static TEST_RUNNER_RELATIVE: std::sync::LazyLock = std::sync::LazyLock::new(|| TEST_RUNNER_PATH.iter().collect()); + static TEST_RUNNER_RELATIVE: std::sync::LazyLock = + std::sync::LazyLock::new(|| TEST_RUNNER_PATH.iter().collect()); const CARGO_DIR: &str = env!("CARGO_MANIFEST_DIR"); let expected = ::std::iter::once(CARGO_DIR) From 8662252693f1595f4e91c959eee66aaa4360b137 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 11 Feb 2026 17:54:04 +0000 Subject: [PATCH 2/3] Revert formatting --- .../test_runner/failure_persistence/file.rs | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/proptest/src/test_runner/failure_persistence/file.rs b/proptest/src/test_runner/failure_persistence/file.rs index 156373e3..8085c063 100644 --- a/proptest/src/test_runner/failure_persistence/file.rs +++ b/proptest/src/test_runner/failure_persistence/file.rs @@ -423,21 +423,20 @@ mod tests { misplaced_file: PathBuf, } - static TEST_PATHS: std::sync::LazyLock = - std::sync::LazyLock::new(|| { - let crate_root = Path::new(env!("CARGO_MANIFEST_DIR")); - let lib_root = crate_root.join("src"); - let src_subdir = lib_root.join("strategy"); - let src_file = lib_root.join("foo.rs"); - let subdir_file = src_subdir.join("foo.rs"); - let misplaced_file = crate_root.join("foo.rs"); - TestPaths { - crate_root, - src_file, - subdir_file, - misplaced_file, - } - }); + static TEST_PATHS: std::sync::LazyLock = std::sync::LazyLock::new(|| { + let crate_root = Path::new(env!("CARGO_MANIFEST_DIR")); + let lib_root = crate_root.join("src"); + let src_subdir = lib_root.join("strategy"); + let src_file = lib_root.join("foo.rs"); + let subdir_file = src_subdir.join("foo.rs"); + let misplaced_file = crate_root.join("foo.rs"); + TestPaths { + crate_root, + src_file, + subdir_file, + misplaced_file, + } + }); #[test] fn persistence_file_location_resolved_correctly() { @@ -501,8 +500,7 @@ mod tests { #[test] fn relative_source_files_absolutified() { const TEST_RUNNER_PATH: &[&str] = &["src", "test_runner", "mod.rs"]; - static TEST_RUNNER_RELATIVE: std::sync::LazyLock = - std::sync::LazyLock::new(|| TEST_RUNNER_PATH.iter().collect()); + static TEST_RUNNER_RELATIVE: std::sync::LazyLock = std::sync::LazyLock::new(|| TEST_RUNNER_PATH.iter().collect()); const CARGO_DIR: &str = env!("CARGO_MANIFEST_DIR"); let expected = ::std::iter::once(CARGO_DIR) From 055e399087b9c557510b5e960f5edca67c7ce7b5 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 11 Feb 2026 18:02:03 +0000 Subject: [PATCH 3/3] Add changelog entry --- proptest/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proptest/CHANGELOG.md b/proptest/CHANGELOG.md index 20d626d3..351757d1 100644 --- a/proptest/CHANGELOG.md +++ b/proptest/CHANGELOG.md @@ -1,3 +1,9 @@ +## Unreleased + +### Other Notes + +- When using failure persistence the shrunken case is now also output to stderr + ## 1.10.0 ### Breaking Changes