From f55bdf754de1c4d4332aad4f7a5a07c820487029 Mon Sep 17 00:00:00 2001 From: Alex Povel Date: Thu, 21 Mar 2024 17:57:31 +0100 Subject: [PATCH] tests: Sanity check for invalid UTF8 test --- tests/cli.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/cli.rs b/tests/cli.rs index 4754bbbe..637f0c3d 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -138,14 +138,18 @@ Duebel } #[test] - #[should_panic] fn test_cli_on_invalid_utf8() { let mut cmd = get_cmd(); let input = b"invalid utf8 \xFF"; + + #[allow(invalid_from_utf8)] // Attribute didn't work on `assert` macro? + let check = std::str::from_utf8(input); + assert!(check.is_err(), "Input is valid UTF8, test is broken"); + cmd.write_stdin(*input); - cmd.assert().success(); + cmd.assert().failure(); } fn get_cmd() -> Command {