Make CmdResult::code private

This commit is contained in:
Gilad Naaman 2021-04-17 16:48:23 +03:00
parent 600bab52ff
commit c5d7f63b3c
3 changed files with 16 additions and 12 deletions

View file

@ -1029,7 +1029,7 @@ fn test_cp_one_file_system() {
at_src.mkdir(TEST_MOUNT_MOUNTPOINT);
let mountpoint_path = &at_src.plus_as_string(TEST_MOUNT_MOUNTPOINT);
let _r = scene
scene
.cmd("mount")
.arg("-t")
.arg("tmpfs")
@ -1037,8 +1037,7 @@ fn test_cp_one_file_system() {
.arg("size=640k") // ought to be enough
.arg("tmpfs")
.arg(mountpoint_path)
.run();
assert!(_r.code == Some(0), "{}", _r.stderr);
.succeeds();
at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE);
@ -1051,8 +1050,7 @@ fn test_cp_one_file_system() {
.run();
// Ditch the mount before the asserts
let _r = scene.cmd("umount").arg(mountpoint_path).run();
assert!(_r.code == Some(0), "{}", _r.stderr);
scene.cmd("umount").arg(mountpoint_path).succeeds();
assert!(result.success);
assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE));

View file

@ -443,9 +443,12 @@ fn test_install_failing_omitting_directory() {
at.mkdir(dir2);
at.touch(file1);
let r = ucmd.arg(dir1).arg(file1).arg(dir2).run();
assert!(r.code == Some(1));
assert!(r.stderr.contains("omitting directory"));
ucmd.arg(dir1)
.arg(file1)
.arg(dir2)
.fails()
.code_is(1)
.stderr_contains("omitting directory");
}
#[test]
@ -458,9 +461,12 @@ fn test_install_failing_no_such_file() {
at.mkdir(dir1);
at.touch(file1);
let r = ucmd.arg(file1).arg(file2).arg(dir1).run();
assert!(r.code == Some(1));
assert!(r.stderr.contains("No such file or directory"));
ucmd.arg(file1)
.arg(file2)
.arg(dir1)
.fails()
.code_is(1)
.stderr_contains("No such file or directory");
}
#[test]

View file

@ -71,7 +71,7 @@ pub struct CmdResult {
//tmpd is used for convenience functions for asserts against fixtures
tmpd: Option<Rc<TempDir>>,
/// exit status for command (if there is one)
pub code: Option<i32>,
code: Option<i32>,
/// zero-exit from running the Command?
/// see [`success`]
pub success: bool,