From 86aff6186ad3fa8fc595560a0d47368f9120ebdc Mon Sep 17 00:00:00 2001 From: Dorian Peron Date: Tue, 25 Feb 2025 01:14:31 +0100 Subject: [PATCH] test-utils: Add fails_with_code() function --- tests/common/util.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 1487a5bb3..d6cfcab34 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1834,6 +1834,14 @@ impl UCommand { cmd_result } + #[track_caller] + pub fn fails_with_code(&mut self, expected_code: i32) -> CmdResult { + let cmd_result = self.run(); + cmd_result.failure(); + cmd_result.code_is(expected_code); + cmd_result + } + pub fn get_full_fixture_path(&self, file_rel_path: &str) -> String { let tmpdir_path = self.tmpd.as_ref().unwrap().path(); format!("{}/{file_rel_path}", tmpdir_path.to_str().unwrap())