From 2900715a742573d743303f559d03bf8ae379a28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Sat, 12 Jul 2025 01:32:10 +0000 Subject: [PATCH] [wip] unit testing - styling, `test_util::make_check_trait_panic` --- src/file/chunk.rs | 2 +- src/test_util/mod.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/file/chunk.rs b/src/file/chunk.rs index 1a70600..d97dfe2 100644 --- a/src/file/chunk.rs +++ b/src/file/chunk.rs @@ -112,7 +112,7 @@ mod tests { } #[test] - #[should_panic(expected = "did not fit into \"u32\"")] + #[should_panic = "did not fit into \"u32\""] fn test_usize_overflow_panics() { // works assert_eq!(from_usize_or_panic::(usize::MAX), u64::MAX); diff --git a/src/test_util/mod.rs b/src/test_util/mod.rs index abba60f..1e14475 100644 --- a/src/test_util/mod.rs +++ b/src/test_util/mod.rs @@ -28,3 +28,9 @@ pub fn create_file(data: &[u8]) -> NamedTempFile { tmp.write_all(data).unwrap(); tmp } + +#[test] +#[should_panic = "`impl foo for bar` expected: 1, actual: 0"] +fn make_check_trait_panic() { + check_trait(0, 1, "foo", "bar"); +}