1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Merge pull request #7369 from RenjiSann/peron/uutest-fails_with_code

test-utils: Add fails_with_code() function
This commit is contained in:
Sylvestre Ledru 2025-02-27 15:09:04 +01:00 committed by GitHub
commit d14ece900c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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())