mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tests: replace .no_stdout().no_stderr() chains with .no_output()
Bulk rename of the antipattern across 19 test files (136 occurrences). .no_output() is the established shorthand in the uutests framework for asserting both empty stdout and empty stderr.
This commit is contained in:
committed by
Daniel Hofstetter
parent
8aa9d9c9b6
commit
f057cc6a01
@@ -306,8 +306,7 @@ fn basic_succeeds() {
|
||||
ucmd.arg(group.as_raw().to_string())
|
||||
.arg("f1")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -615,8 +615,7 @@ fn test_chmod_symlink_non_existing_file_recursive() {
|
||||
.arg("755")
|
||||
.arg(test_directory)
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
let expected_stdout = &format!(
|
||||
// spell-checker:disable-next-line
|
||||
|
||||
@@ -517,7 +517,7 @@ fn test_chown_only_user_id_nonexistent_user() {
|
||||
let at = &ts.fixtures;
|
||||
at.touch("f");
|
||||
if let Ok(result) = run_ucmd_as_root(&ts, &["12345", "f"]) {
|
||||
result.success().no_stdout().no_stderr();
|
||||
result.success().no_output();
|
||||
} else {
|
||||
print!("Test skipped; requires root user");
|
||||
}
|
||||
@@ -585,7 +585,7 @@ fn test_chown_only_group_id_nonexistent_group() {
|
||||
let at = &ts.fixtures;
|
||||
at.touch("f");
|
||||
if let Ok(result) = run_ucmd_as_root(&ts, &[":12345", "f"]) {
|
||||
result.success().no_stdout().no_stderr();
|
||||
result.success().no_output();
|
||||
} else {
|
||||
print!("Test skipped; requires root user");
|
||||
}
|
||||
|
||||
+30
-78
@@ -479,8 +479,7 @@ fn test_cp_arg_update_none() {
|
||||
.arg(TEST_HOW_ARE_YOU_SOURCE)
|
||||
.arg("--update=none")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n");
|
||||
}
|
||||
|
||||
@@ -503,8 +502,7 @@ fn test_cp_arg_update_all() {
|
||||
.arg(TEST_HOW_ARE_YOU_SOURCE)
|
||||
.arg("--update=all")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(
|
||||
at.read(TEST_HOW_ARE_YOU_SOURCE),
|
||||
@@ -528,8 +526,7 @@ fn test_cp_arg_update_older_dest_not_older_than_src() {
|
||||
.arg(new)
|
||||
.arg("--update=older")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(new), "new content\n");
|
||||
}
|
||||
@@ -551,8 +548,7 @@ fn test_cp_arg_update_older_dest_not_older_than_src_no_verbose_output() {
|
||||
.arg("--verbose")
|
||||
.arg("--update=older")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(new), "new content\n");
|
||||
}
|
||||
@@ -576,8 +572,7 @@ fn test_cp_arg_update_older_dest_older_than_src() {
|
||||
.arg(old)
|
||||
.arg("--update=older")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(old), "new content\n");
|
||||
}
|
||||
@@ -624,12 +619,7 @@ fn test_cp_arg_update_short_no_overwrite() {
|
||||
|
||||
at.write(new, new_content);
|
||||
|
||||
ucmd.arg(old)
|
||||
.arg(new)
|
||||
.arg("-u")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.arg(old).arg(new).arg("-u").succeeds().no_output();
|
||||
|
||||
assert_eq!(at.read(new), "new content\n");
|
||||
}
|
||||
@@ -650,12 +640,7 @@ fn test_cp_arg_update_short_overwrite() {
|
||||
|
||||
at.write(new, new_content);
|
||||
|
||||
ucmd.arg(new)
|
||||
.arg(old)
|
||||
.arg("-u")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.arg(new).arg(old).arg("-u").succeeds().no_output();
|
||||
|
||||
assert_eq!(at.read(old), "new content\n");
|
||||
}
|
||||
@@ -682,8 +667,7 @@ fn test_cp_arg_update_none_then_all() {
|
||||
.arg("--update=none")
|
||||
.arg("--update=all")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(new), "old content\n");
|
||||
}
|
||||
@@ -710,8 +694,7 @@ fn test_cp_arg_update_all_then_none() {
|
||||
.arg("--update=all")
|
||||
.arg("--update=none")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(new), "new content\n");
|
||||
}
|
||||
@@ -2940,8 +2923,7 @@ fn test_no_preserve_mode() {
|
||||
.arg("dest")
|
||||
.umask(libc::mode_t::from(umask))
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
// remove sticky bit, setuid and setgid bit; apply umask
|
||||
let expected_perms = PERMS_ALL & !0o7000 & u32::from(!umask);
|
||||
assert_eq!(
|
||||
@@ -2970,8 +2952,7 @@ fn test_preserve_mode() {
|
||||
.arg("dest")
|
||||
.arg("-p")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
assert_eq!(
|
||||
at.plus("dest").metadata().unwrap().mode() & 0o7777,
|
||||
PERMS_ALL
|
||||
@@ -2984,11 +2965,7 @@ fn test_canonicalize_symlink() {
|
||||
at.mkdir("dir");
|
||||
at.touch("dir/file");
|
||||
at.relative_symlink_file("../dir/file", "dir/file-ln");
|
||||
ucmd.arg("dir/file-ln")
|
||||
.arg(".")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.arg("dir/file-ln").arg(".").succeeds().no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3053,8 +3030,7 @@ fn test_copy_through_dangling_symlink_no_dereference() {
|
||||
.arg("dangle")
|
||||
.arg("d2")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3128,8 +3104,7 @@ fn test_copy_through_dangling_symlink_no_dereference_permissions() {
|
||||
// V V V V
|
||||
ucmd.args(&["-P", "-p", "dangle", "d2"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
assert!(at.symlink_exists("d2"), "symlink wasn't created");
|
||||
|
||||
// `-p` means `--preserve=mode,ownership,timestamps`
|
||||
@@ -3203,8 +3178,7 @@ fn test_cp_fifo() {
|
||||
.arg("fifo")
|
||||
.arg("fifo2")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
assert!(at.is_fifo("fifo2"));
|
||||
|
||||
let metadata = std::fs::metadata(at.subdir.join("fifo2")).unwrap();
|
||||
@@ -3351,8 +3325,7 @@ fn test_cp_socket() {
|
||||
.arg("socket")
|
||||
.arg("socket2")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
let metadata = std::fs::metadata(at.subdir.join("socket2")).unwrap();
|
||||
let permission = uucore::fs::display_permissions(&metadata, true);
|
||||
@@ -3411,8 +3384,7 @@ fn test_cp_r_symlink() {
|
||||
.arg("tmp")
|
||||
.arg("tmp2")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
// Is symlink2 still a symlink, and does it point at the same place?
|
||||
assert!(at.is_symlink("tmp2/symlink"));
|
||||
@@ -3561,8 +3533,7 @@ fn test_cp_parents_2_dirs() {
|
||||
at.mkdir("d");
|
||||
ucmd.args(&["-a", "--parents", "a/b/c", "d"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
assert!(at.dir_exists("d/a/b/c"));
|
||||
}
|
||||
|
||||
@@ -3735,8 +3706,7 @@ fn test_remove_destination_symbolic_link_loop() {
|
||||
at.touch("f");
|
||||
ucmd.args(&["--remove-destination", "f", "loop"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(at.file_exists("loop"));
|
||||
}
|
||||
|
||||
@@ -3747,10 +3717,7 @@ fn test_cp_symbolic_link_loop() {
|
||||
at.symlink_file("loop", "loop");
|
||||
at.plus("loop");
|
||||
at.touch("f");
|
||||
ucmd.args(&["-f", "f", "loop"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
ucmd.args(&["-f", "f", "loop"]).succeeds().no_output();
|
||||
assert!(at.file_exists("loop"));
|
||||
}
|
||||
|
||||
@@ -3799,10 +3766,7 @@ fn test_copy_dir_preserve_permissions() {
|
||||
// | | | to this destination
|
||||
// | | | |
|
||||
// V V V V
|
||||
ucmd.args(&["-p", "-R", "d1", "d2"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&["-p", "-R", "d1", "d2"]).succeeds().no_output();
|
||||
assert!(at.dir_exists("d2"));
|
||||
|
||||
// Assert that the permissions are preserved.
|
||||
@@ -3822,10 +3786,7 @@ fn test_copy_dir_preserve_subdir_permissions() {
|
||||
at.set_mode("a1/a2", 0o0555);
|
||||
at.set_mode("a1", 0o0777);
|
||||
|
||||
ucmd.args(&["-p", "-r", "a1", "b1"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&["-p", "-r", "a1", "b1"]).succeeds().no_output();
|
||||
|
||||
// Make sure everything is preserved
|
||||
assert!(at.dir_exists("b1"));
|
||||
@@ -3847,8 +3808,7 @@ fn test_copy_dir_preserve_readonly_source_with_files() {
|
||||
|
||||
ucmd.args(&["-p", "-r", "src", "dest"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert!(at.dir_exists("dest"));
|
||||
assert_eq!(at.read("dest/file.txt"), "hello");
|
||||
@@ -3920,8 +3880,7 @@ fn test_same_file_force_backup() {
|
||||
at.touch("f");
|
||||
ucmd.args(&["--force", "--backup", "f", "f"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(at.file_exists("f~"));
|
||||
}
|
||||
|
||||
@@ -3947,7 +3906,7 @@ fn test_copy_contents_fifo() {
|
||||
// At this point the child process should have terminated
|
||||
// successfully with no output. The `outfile` should have the
|
||||
// contents of `fifo` copied into it.
|
||||
child.wait().unwrap().no_stdout().no_stderr().success();
|
||||
child.wait().unwrap().no_output().success();
|
||||
assert_eq!(at.read("outfile"), "foo");
|
||||
}
|
||||
|
||||
@@ -3968,8 +3927,7 @@ fn test_reflink_never_sparse_always() {
|
||||
|
||||
ucmd.args(&["--reflink=never", "--sparse=always", "src", "dest"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
at.file_exists("dest");
|
||||
|
||||
let src_metadata = std::fs::metadata(at.plus("src")).unwrap();
|
||||
@@ -4046,8 +4004,7 @@ fn test_src_base_dot() {
|
||||
.current_dir(at.plus("y"))
|
||||
.args(&["--verbose", "-r", "../x/.", "."])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
assert!(!at.dir_exists("y/x"));
|
||||
}
|
||||
|
||||
@@ -4065,10 +4022,7 @@ fn test_non_utf8_src() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let src = non_utf8_name("src");
|
||||
std::fs::File::create(at.plus(&src)).unwrap();
|
||||
ucmd.args(&[src, "dest".into()])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&[src, "dest".into()]).succeeds().no_output();
|
||||
assert!(at.file_exists("dest"));
|
||||
}
|
||||
|
||||
@@ -4079,8 +4033,7 @@ fn test_non_utf8_dest() {
|
||||
let dest = non_utf8_name("dest");
|
||||
ucmd.args(&[TEST_HELLO_WORLD_SOURCE.as_ref(), &*dest])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
assert!(at.file_exists(dest));
|
||||
}
|
||||
|
||||
@@ -4092,8 +4045,7 @@ fn test_non_utf8_target() {
|
||||
at.mkdir(&dest);
|
||||
ucmd.args(&["-t".as_ref(), &*dest, TEST_HELLO_WORLD_SOURCE.as_ref()])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
let mut copied_file = PathBuf::from(dest);
|
||||
copied_file.push(TEST_HELLO_WORLD_SOURCE);
|
||||
assert!(at.file_exists(copied_file));
|
||||
|
||||
@@ -931,8 +931,7 @@ fn test_skip_to_no_match5() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["numbers50.txt", "%nope%", "{*}"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
let count = glob(&at.plus_as_string("xx*"))
|
||||
.expect("counting splits")
|
||||
|
||||
@@ -430,8 +430,7 @@ fn test_date_set_valid() {
|
||||
.arg("--set")
|
||||
.arg("2020-03-12 13:30:00+08:00")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,8 +498,7 @@ fn test_date_set_valid_2() {
|
||||
.arg("--set")
|
||||
.arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,8 +578,7 @@ fn test_date_set_valid_3() {
|
||||
.arg("--set")
|
||||
.arg("Sat 20 Mar 2021 14:53:01") // Local timezone
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,8 +590,7 @@ fn test_date_set_valid_4() {
|
||||
.arg("--set")
|
||||
.arg("2020-03-11 21:45:00") // Local timezone
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -233,15 +233,13 @@ fn test_zero_multiplier_warning() {
|
||||
.args(&[format!("{arg}=0").as_str(), "status=none"])
|
||||
.pipe_in("")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&[format!("{arg}=00x1").as_str(), "status=none"])
|
||||
.pipe_in("")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&[format!("{arg}=0x1").as_str(), "status=none"])
|
||||
|
||||
@@ -800,7 +800,7 @@ fn test_uchild_when_run_no_wait_with_a_non_blocking_util() {
|
||||
child.kill();
|
||||
|
||||
// we should be able to call wait without panics and apply some assertions
|
||||
child.wait().unwrap().code_is(0).no_stdout().no_stderr();
|
||||
child.wait().unwrap().code_is(0).no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -879,8 +879,7 @@ fn test_install_on_invalid_link_at_destination() {
|
||||
.arg(src_dir.join("test.sh"))
|
||||
.arg(dst_dir.join("test.sh"))
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[cfg(all(unix, feature = "chmod"))]
|
||||
@@ -908,8 +907,7 @@ fn test_install_on_invalid_link_at_destination_and_dev_null_at_source() {
|
||||
.arg("/dev/null")
|
||||
.arg(dst_dir.join("test.sh"))
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -156,8 +156,7 @@ fn test_mkdir_parent_mode() {
|
||||
.arg("a/b")
|
||||
.umask(default_umask)
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert!(at.dir_exists("a"));
|
||||
// parents created by -p have permissions set to "=rwx,u+wx"
|
||||
@@ -187,8 +186,7 @@ fn test_mkdir_parent_mode_check_existing_parent() {
|
||||
.arg("a/b/c")
|
||||
.umask(default_umask)
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert!(at.dir_exists("a"));
|
||||
// parent dirs that already exist do not get their permissions modified
|
||||
@@ -220,8 +218,7 @@ fn test_mkdir_parent_mode_skip_existing_last_component_chmod() {
|
||||
.arg("a/b")
|
||||
.umask(default_umask)
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.metadata("a/b").permissions().mode() as mode_t, 0o40000);
|
||||
}
|
||||
@@ -919,8 +916,7 @@ fn test_mkdir_parent_inherits_setgid() {
|
||||
ucmd.arg("-p")
|
||||
.arg("parent/child/grandchild")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
// All descendants should inherit the setgid bit (0o2000)
|
||||
assert_eq!(at.metadata("parent").permissions().mode() & 0o2000, 0o2000);
|
||||
|
||||
@@ -316,8 +316,7 @@ fn test_mktemp_quiet() {
|
||||
.arg("/definitely/not/exist/I/promise")
|
||||
.arg("-q")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-d")
|
||||
@@ -325,8 +324,7 @@ fn test_mktemp_quiet() {
|
||||
.arg("/definitely/not/exist/I/promise")
|
||||
.arg("-q")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+11
-34
@@ -69,7 +69,7 @@ fn test_mv_with_source_file_opened_and_target_file_exists() {
|
||||
|
||||
at.touch(dst);
|
||||
|
||||
ucmd.arg(src).arg(dst).succeeds().no_stderr().no_stdout();
|
||||
ucmd.arg(src).arg(dst).succeeds().no_output();
|
||||
|
||||
drop(f);
|
||||
}
|
||||
@@ -361,8 +361,7 @@ fn test_mv_arg_update_interactive() {
|
||||
.arg("-i")
|
||||
.arg("--update")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -637,13 +636,7 @@ fn test_mv_broken_symlink_to_another_fs() {
|
||||
TempDir::new_in("/dev/shm/").expect("Unable to create temp directory in /dev/shm");
|
||||
let dest = other_fs_tempdir.path().join("foo");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("foo")
|
||||
.arg(dest)
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
scene.ucmd().arg("foo").arg(dest).succeeds().no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1161,8 +1154,7 @@ fn test_mv_arg_update_none() {
|
||||
.arg(file2)
|
||||
.arg("--update=none")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(file2), file2_content);
|
||||
}
|
||||
@@ -1183,8 +1175,7 @@ fn test_mv_arg_update_all() {
|
||||
.arg(file2)
|
||||
.arg("--update=all")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(file2), file1_content);
|
||||
}
|
||||
@@ -1208,8 +1199,7 @@ fn test_mv_arg_update_older_dest_not_older() {
|
||||
.arg(new)
|
||||
.arg("--update=older")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(new), new_content);
|
||||
}
|
||||
@@ -1236,8 +1226,7 @@ fn test_mv_arg_update_none_then_all() {
|
||||
.arg("--update=none")
|
||||
.arg("--update=all")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(new), "old content\n");
|
||||
}
|
||||
@@ -1264,8 +1253,7 @@ fn test_mv_arg_update_all_then_none() {
|
||||
.arg("--update=all")
|
||||
.arg("--update=none")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(new), "new content\n");
|
||||
}
|
||||
@@ -1289,8 +1277,7 @@ fn test_mv_arg_update_older_dest_older() {
|
||||
.arg(old)
|
||||
.arg("--update=all")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
assert_eq!(at.read(old), new_content);
|
||||
}
|
||||
@@ -1335,12 +1322,7 @@ fn test_mv_arg_update_short_overwrite() {
|
||||
|
||||
at.write(new, new_content);
|
||||
|
||||
ucmd.arg(new)
|
||||
.arg(old)
|
||||
.arg("-u")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.arg(new).arg(old).arg("-u").succeeds().no_output();
|
||||
|
||||
assert_eq!(at.read(old), new_content);
|
||||
}
|
||||
@@ -1361,12 +1343,7 @@ fn test_mv_arg_update_short_no_overwrite() {
|
||||
|
||||
at.write(new, new_content);
|
||||
|
||||
ucmd.arg(old)
|
||||
.arg(new)
|
||||
.arg("-u")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.arg(old).arg(new).arg("-u").succeeds().no_output();
|
||||
|
||||
assert_eq!(at.read(new), new_content);
|
||||
}
|
||||
|
||||
@@ -455,12 +455,7 @@ fn test_verbose_or_silent() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch("regfile");
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("regfile")
|
||||
.fails_with_code(1)
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
scene.ucmd().arg("regfile").fails_with_code(1).no_output();
|
||||
scene
|
||||
.ucmd()
|
||||
.args(&["-v", "regfile"])
|
||||
@@ -476,8 +471,7 @@ fn test_verbose_or_silent() {
|
||||
.ucmd()
|
||||
.args(&["-vs", "regfile"])
|
||||
.fails_with_code(1)
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
scene
|
||||
.ucmd()
|
||||
.args(&["-sv", "regfile"])
|
||||
|
||||
@@ -1113,5 +1113,5 @@ fn test_seed_long_range_no_repeat() {
|
||||
|
||||
#[test]
|
||||
fn test_empty_range_no_repeat() {
|
||||
new_ucmd!().arg("-i4-3").succeeds().no_stderr().no_stdout();
|
||||
new_ucmd!().arg("-i4-3").succeeds().no_output();
|
||||
}
|
||||
|
||||
@@ -1548,8 +1548,7 @@ fn test_merge_empty_input() {
|
||||
new_ucmd!()
|
||||
.args(&["-m", "empty.txt"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+29
-65
@@ -411,8 +411,7 @@ fn test_split_lines_number() {
|
||||
.ucmd()
|
||||
.args(&["--lines", "2", "file"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
scene
|
||||
.ucmd()
|
||||
.args(&["--lines", "0", "file"])
|
||||
@@ -476,7 +475,7 @@ fn test_split_obs_lines_standalone() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let name = "obs-lines-standalone";
|
||||
RandomFile::new(&at, name).add_lines(4);
|
||||
ucmd.args(&["-2", name]).succeeds().no_stderr().no_stdout();
|
||||
ucmd.args(&["-2", name]).succeeds().no_output();
|
||||
let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$");
|
||||
assert_eq!(glob.count(), 2);
|
||||
assert_eq!(glob.collate(), at.read_bytes(name));
|
||||
@@ -490,8 +489,7 @@ fn test_split_obs_lines_standalone_overflow() {
|
||||
RandomFile::new(&at, name).add_lines(4);
|
||||
ucmd.args(&["-99999999999999999991", name])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$");
|
||||
assert_eq!(glob.count(), 1);
|
||||
assert_eq!(glob.collate(), at.read_bytes(name));
|
||||
@@ -517,10 +515,7 @@ fn test_split_obs_lines_within_combined_shorts() {
|
||||
let name = "obs-lines-within-shorts";
|
||||
RandomFile::new(&at, name).add_lines(400);
|
||||
|
||||
ucmd.args(&["-x200de", name])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&["-x200de", name]).succeeds().no_output();
|
||||
let glob = Glob::new(&at, ".", r"x\d\d$");
|
||||
assert_eq!(glob.count(), 2);
|
||||
assert_eq!(glob.collate(), at.read_bytes(name));
|
||||
@@ -548,10 +543,7 @@ fn test_split_obs_lines_starts_combined_shorts() {
|
||||
let name = "obs-lines-starts-shorts";
|
||||
RandomFile::new(&at, name).add_lines(400);
|
||||
|
||||
ucmd.args(&["-200xd", name])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&["-200xd", name]).succeeds().no_output();
|
||||
|
||||
let glob = Glob::new(&at, ".", r"x\d\d$");
|
||||
assert_eq!(glob.count(), 2);
|
||||
@@ -650,10 +642,7 @@ fn test_split_multiple_obs_lines_standalone() {
|
||||
let name = "multiple-obs-lines";
|
||||
RandomFile::new(&at, name).add_lines(400);
|
||||
|
||||
ucmd.args(&["-3000", "-200", name])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&["-3000", "-200", name]).succeeds().no_output();
|
||||
|
||||
let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$");
|
||||
assert_eq!(glob.count(), 2);
|
||||
@@ -671,8 +660,7 @@ fn test_split_multiple_obs_lines_within_combined() {
|
||||
|
||||
ucmd.args(&["-d5000x", "-e200d", name])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
|
||||
let glob = Glob::new(&at, ".", r"x\d\d$");
|
||||
assert_eq!(glob.count(), 2);
|
||||
@@ -1140,10 +1128,7 @@ fn test_include_newlines() {
|
||||
#[test]
|
||||
fn test_split_number_chunks_short_concatenated_with_value() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-n3", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
ucmd.args(&["-n3", "threebytes.txt"]).succeeds().no_output();
|
||||
assert_eq!(at.read("xaa"), "a");
|
||||
assert_eq!(at.read("xab"), "b");
|
||||
assert_eq!(at.read("xac"), "c");
|
||||
@@ -1154,8 +1139,7 @@ fn test_allow_empty_files() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-n", "4", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "a");
|
||||
assert_eq!(at.read("xab"), "b");
|
||||
assert_eq!(at.read("xac"), "c");
|
||||
@@ -1167,8 +1151,7 @@ fn test_elide_empty_files_n_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-e", "-n", "4", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "a");
|
||||
assert_eq!(at.read("xab"), "b");
|
||||
assert_eq!(at.read("xac"), "c");
|
||||
@@ -1181,8 +1164,7 @@ fn test_elide_dev_null_n_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-e", "-n", "3", "/dev/null"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(!at.plus("xaa").exists());
|
||||
assert!(!at.plus("xab").exists());
|
||||
assert!(!at.plus("xac").exists());
|
||||
@@ -1205,8 +1187,7 @@ fn test_elide_empty_files_l_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-e", "-n", "l/7", "fivelines.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "1\n");
|
||||
assert_eq!(at.read("xab"), "2\n");
|
||||
assert_eq!(at.read("xac"), "3\n");
|
||||
@@ -1222,8 +1203,7 @@ fn test_elide_dev_null_l_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-e", "-n", "l/3", "/dev/null"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(!at.plus("xaa").exists());
|
||||
assert!(!at.plus("xab").exists());
|
||||
assert!(!at.plus("xac").exists());
|
||||
@@ -1326,8 +1306,7 @@ fn test_line_bytes_no_final_newline() {
|
||||
ucmd.args(&["-C", "2"])
|
||||
.pipe_in("1\n2222\n3\n4")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "1\n");
|
||||
assert_eq!(at.read("xab"), "22");
|
||||
assert_eq!(at.read("xac"), "22");
|
||||
@@ -1342,8 +1321,7 @@ fn test_line_bytes_no_empty_file() {
|
||||
ucmd.args(&["-C", "1"])
|
||||
.pipe_in("1\n2222\n3\n4")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "1");
|
||||
assert_eq!(at.read("xab"), "\n");
|
||||
assert_eq!(at.read("xac"), "2");
|
||||
@@ -1363,8 +1341,7 @@ fn test_line_bytes_no_eof() {
|
||||
ucmd.args(&["-C", "3"])
|
||||
.pipe_in("1\n2222\n3\n4")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "1\n");
|
||||
assert_eq!(at.read("xab"), "222");
|
||||
assert_eq!(at.read("xac"), "2\n");
|
||||
@@ -1383,8 +1360,7 @@ fn test_guard_input() {
|
||||
.args(&["-C", "6"])
|
||||
.pipe_in("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "1\n2\n3\n");
|
||||
|
||||
scene
|
||||
@@ -1392,8 +1368,7 @@ fn test_guard_input() {
|
||||
.args(&["-C", "6"])
|
||||
.pipe_in("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("xaa"), "1\n2\n3\n");
|
||||
|
||||
scene
|
||||
@@ -1424,8 +1399,7 @@ fn test_numeric_suffix() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-n", "4", "--numeric-suffixes=9", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x09"), "a");
|
||||
assert_eq!(at.read("x10"), "b");
|
||||
assert_eq!(at.read("x11"), "c");
|
||||
@@ -1437,8 +1411,7 @@ fn test_numeric_suffix_inferred() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-n", "4", "--numeric=9", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x09"), "a");
|
||||
assert_eq!(at.read("x10"), "b");
|
||||
assert_eq!(at.read("x11"), "c");
|
||||
@@ -1450,8 +1423,7 @@ fn test_hex_suffix() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-n", "4", "--hex-suffixes=9", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x09"), "a");
|
||||
assert_eq!(at.read("x0a"), "b");
|
||||
assert_eq!(at.read("x0b"), "c");
|
||||
@@ -1463,8 +1435,7 @@ fn test_hex_suffix_alias() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-n", "4", "--hex=9", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x09"), "a");
|
||||
assert_eq!(at.read("x0a"), "b");
|
||||
assert_eq!(at.read("x0b"), "c");
|
||||
@@ -1493,8 +1464,7 @@ fn test_short_numeric_suffix_no_value() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-l", "9", "-d", "onehundredlines.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n");
|
||||
assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n");
|
||||
assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n");
|
||||
@@ -1515,8 +1485,7 @@ fn test_numeric_suffix_no_value() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-l", "9", "--numeric-suffixes", "onehundredlines.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n");
|
||||
assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n");
|
||||
assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n");
|
||||
@@ -1537,8 +1506,7 @@ fn test_short_hex_suffix_no_value() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-l", "9", "-x", "onehundredlines.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n");
|
||||
assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n");
|
||||
assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n");
|
||||
@@ -1559,8 +1527,7 @@ fn test_hex_suffix_no_value() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-l", "9", "--hex-suffixes", "onehundredlines.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x00"), "00\n01\n02\n03\n04\n05\n06\n07\n08\n");
|
||||
assert_eq!(at.read("x01"), "09\n10\n11\n12\n13\n14\n15\n16\n17\n");
|
||||
assert_eq!(at.read("x02"), "18\n19\n20\n21\n22\n23\n24\n25\n26\n");
|
||||
@@ -1599,8 +1566,7 @@ fn test_short_combination() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-dxen", "4", "threebytes.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x00"), "a");
|
||||
assert_eq!(at.read("x01"), "b");
|
||||
assert_eq!(at.read("x02"), "c");
|
||||
@@ -1623,8 +1589,7 @@ fn test_effective_suffix_numeric_last() {
|
||||
"threebytes.txt",
|
||||
])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x09"), "a");
|
||||
assert_eq!(at.read("x10"), "b");
|
||||
assert_eq!(at.read("x11"), "c");
|
||||
@@ -1647,8 +1612,7 @@ fn test_effective_suffix_hex_last() {
|
||||
"threebytes.txt",
|
||||
])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert_eq!(at.read("x09"), "a");
|
||||
assert_eq!(at.read("x0a"), "b");
|
||||
assert_eq!(at.read("x0b"), "c");
|
||||
|
||||
+32
-85
@@ -440,11 +440,7 @@ fn test_follow_stdin_descriptor() {
|
||||
.args(&args)
|
||||
.run_no_wait();
|
||||
p.make_assertion_with_delay(500).is_alive();
|
||||
p.kill()
|
||||
.make_assertion()
|
||||
.with_all_output()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
p.kill().make_assertion().with_all_output().no_output();
|
||||
|
||||
args.pop();
|
||||
}
|
||||
@@ -806,8 +802,7 @@ fn test_follow_with_pid() {
|
||||
.make_assertion_with_delay(DEFAULT_SLEEP_INTERVAL_MILLIS)
|
||||
.is_not_alive()
|
||||
.with_current_output()
|
||||
.no_stderr()
|
||||
.no_stdout()
|
||||
.no_output()
|
||||
.success();
|
||||
}
|
||||
|
||||
@@ -1104,8 +1099,7 @@ fn test_positive_zero_bytes() {
|
||||
.pipe_in("abcde")
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
/// Test for reading all but the first NUM lines: `tail -n +3`.
|
||||
@@ -1185,8 +1179,7 @@ fn test_obsolete_syntax_zero_lines_file() {
|
||||
new_ucmd!()
|
||||
.args(&["-0", "foobar.txt"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
/// Test for reading all lines, specified by `tail -n +0`.
|
||||
@@ -1203,8 +1196,7 @@ fn test_positive_zero_lines() {
|
||||
.pipe_in("a\nb\nc\nd\ne\n")
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2692,11 +2684,7 @@ fn test_follow_inotify_only_regular() {
|
||||
let mut p = ts.ucmd().arg("-f").arg("/dev/null").run_no_wait();
|
||||
|
||||
p.make_assertion_with_delay(200).is_alive();
|
||||
p.kill()
|
||||
.make_assertion()
|
||||
.with_all_output()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
p.kill().make_assertion().with_all_output().no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2746,20 +2734,12 @@ fn test_fifo() {
|
||||
|
||||
let mut p = ts.ucmd().arg("FIFO").run_no_wait();
|
||||
p.make_assertion_with_delay(500).is_alive();
|
||||
p.kill()
|
||||
.make_assertion()
|
||||
.with_all_output()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
p.kill().make_assertion().with_all_output().no_output();
|
||||
|
||||
for arg in ["-f", "-F"] {
|
||||
let mut p = ts.ucmd().arg(arg).arg("FIFO").run_no_wait();
|
||||
p.make_assertion_with_delay(500).is_alive();
|
||||
p.kill()
|
||||
.make_assertion()
|
||||
.with_all_output()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
p.kill().make_assertion().with_all_output().no_output();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2797,8 +2777,7 @@ fn test_fifo_with_pid() {
|
||||
.make_assertion_with_delay(DEFAULT_SLEEP_INTERVAL_MILLIS)
|
||||
.is_not_alive()
|
||||
.with_all_output()
|
||||
.no_stderr()
|
||||
.no_stdout()
|
||||
.no_output()
|
||||
.success();
|
||||
}
|
||||
|
||||
@@ -2861,24 +2840,21 @@ fn test_pipe_when_lines_option_value_is_higher_than_contained_lines() {
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-n", "+4"])
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-n", "+999"])
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2890,8 +2866,7 @@ fn test_pipe_when_negative_lines_option_given_no_newline_at_eof() {
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-n", "1"])
|
||||
@@ -2972,8 +2947,7 @@ fn test_pipe_when_lines_option_given_multibyte_utf8_characters() {
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-n", "-4"])
|
||||
@@ -3008,8 +2982,7 @@ fn test_pipe_when_lines_option_given_multibyte_utf8_characters() {
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3075,8 +3048,7 @@ fn test_pipe_when_lines_option_given_input_size_is_equal_to_buffer_size() {
|
||||
.pipe_in(random_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
let expected = lines.clone().skip(total_lines - 1).collect::<String>();
|
||||
new_ucmd!()
|
||||
@@ -3183,8 +3155,7 @@ fn test_pipe_when_lines_option_given_input_size_has_multiple_size_of_buffer_size
|
||||
.pipe_in(random_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
let expected = lines.clone().skip(total_lines - 1).collect::<String>();
|
||||
new_ucmd!()
|
||||
@@ -3239,24 +3210,21 @@ fn test_pipe_when_bytes_option_value_is_higher_than_contained_bytes() {
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-c", "+5"])
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-c", "+999"])
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3304,8 +3272,7 @@ fn test_pipe_when_bytes_option_given_multibyte_utf8_characters() {
|
||||
.pipe_in(test_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-c", "-1"])
|
||||
@@ -3368,8 +3335,7 @@ fn test_pipe_when_bytes_option_given_input_size_is_equal_to_buffer_size() {
|
||||
.pipe_in(random_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
let expected = &random_string.as_bytes()[1..];
|
||||
new_ucmd!()
|
||||
@@ -3427,8 +3393,7 @@ fn test_pipe_when_bytes_option_given_input_size_is_one_byte_greater_than_buffer_
|
||||
.pipe_in(random_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
let expected = &random_string.as_bytes()[CHUNK_BUFFER_SIZE..];
|
||||
new_ucmd!()
|
||||
@@ -3474,8 +3439,7 @@ fn test_pipe_when_bytes_option_given_input_size_has_multiple_size_of_buffer_size
|
||||
.pipe_in(random_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
let expected = &random_string.as_bytes()[8192..];
|
||||
new_ucmd!()
|
||||
@@ -3583,8 +3547,7 @@ fn test_args_when_presume_input_pipe_given_input_is_pipe() {
|
||||
.pipe_in(random_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["---presume-input-pipe", "-c", "+0"])
|
||||
@@ -3598,8 +3561,7 @@ fn test_args_when_presume_input_pipe_given_input_is_pipe() {
|
||||
.pipe_in(random_string)
|
||||
.ignore_stdin_write_error()
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["---presume-input-pipe", "-n", "+0"])
|
||||
@@ -3621,8 +3583,7 @@ fn test_args_when_presume_input_pipe_given_input_is_file() {
|
||||
ts.ucmd()
|
||||
.args(&["---presume-input-pipe", "-c", "-0", "data"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
ts.ucmd()
|
||||
.args(&["---presume-input-pipe", "-c", "+0", "data"])
|
||||
@@ -3632,8 +3593,7 @@ fn test_args_when_presume_input_pipe_given_input_is_file() {
|
||||
ts.ucmd()
|
||||
.args(&["---presume-input-pipe", "-n", "-0", "data"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
|
||||
ts.ucmd()
|
||||
.args(&["---presume-input-pipe", "-n", "+0", "data"])
|
||||
@@ -3684,11 +3644,7 @@ fn test_when_argument_file_is_a_symlink() {
|
||||
|
||||
at.symlink_file("target", "link");
|
||||
|
||||
ts.ucmd()
|
||||
.args(&["-c", "+0", "link"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
ts.ucmd().args(&["-c", "+0", "link"]).succeeds().no_output();
|
||||
|
||||
let random_string = RandomizedString::generate(AlphanumericNewline, 100);
|
||||
let result = file.write_all(random_string.as_bytes());
|
||||
@@ -4915,11 +4871,7 @@ fn test_gnu_args_f() {
|
||||
at.touch(source);
|
||||
let mut p = scene.ucmd().args(&["+f", source]).run_no_wait();
|
||||
p.make_assertion_with_delay(500).is_alive();
|
||||
p.kill()
|
||||
.make_assertion()
|
||||
.with_all_output()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
p.kill().make_assertion().with_all_output().no_output();
|
||||
|
||||
let mut p = scene
|
||||
.ucmd()
|
||||
@@ -4927,11 +4879,7 @@ fn test_gnu_args_f() {
|
||||
.arg("+f")
|
||||
.run_no_wait();
|
||||
p.make_assertion_with_delay(500).is_alive();
|
||||
p.kill()
|
||||
.make_assertion()
|
||||
.with_all_output()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
p.kill().make_assertion().with_all_output().no_output();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -5040,8 +4988,7 @@ fn test_when_piped_input_then_no_broken_pipe() {
|
||||
.args(&["-n", "0"])
|
||||
.pipe_in(test_string)
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -710,10 +710,7 @@ fn test_touch_set_date_relative_smoke() {
|
||||
for time in times {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.touch("f");
|
||||
ucmd.args(&["-d", time, "f"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&["-d", time, "f"]).succeeds().no_output();
|
||||
}
|
||||
|
||||
// From the GNU documentation:
|
||||
@@ -735,10 +732,7 @@ fn test_touch_set_date_relative_smoke() {
|
||||
for time in times {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.touch("f");
|
||||
ucmd.args(&["-d", time, "f"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
ucmd.args(&["-d", time, "f"]).succeeds().no_output();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,10 +296,7 @@ fn test_truncate_bytes_size() {
|
||||
fn test_new_file() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let filename = "new_file_that_does_not_exist_yet";
|
||||
ucmd.args(&["-s", "8", filename])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
ucmd.args(&["-s", "8", filename]).succeeds().no_output();
|
||||
assert!(at.file_exists(filename));
|
||||
assert_eq!(at.read_bytes(filename), vec![b'\0'; 8]);
|
||||
}
|
||||
@@ -311,10 +308,7 @@ fn test_new_file_reference() {
|
||||
let mut old_file = at.make_file(FILE1);
|
||||
old_file.write_all(b"1234567890").unwrap();
|
||||
let filename = "new_file_that_does_not_exist_yet";
|
||||
ucmd.args(&["-r", FILE1, filename])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
ucmd.args(&["-r", FILE1, filename]).succeeds().no_output();
|
||||
assert!(at.file_exists(filename));
|
||||
assert_eq!(at.read_bytes(filename), vec![b'\0'; 10]);
|
||||
}
|
||||
@@ -328,8 +322,7 @@ fn test_new_file_size_and_reference() {
|
||||
let filename = "new_file_that_does_not_exist_yet";
|
||||
ucmd.args(&["-s", "+3", "-r", FILE1, filename])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(at.file_exists(filename));
|
||||
assert_eq!(at.read_bytes(filename), vec![b'\0'; 13]);
|
||||
}
|
||||
@@ -341,8 +334,7 @@ fn test_new_file_no_create_size_only() {
|
||||
let filename = "new_file_that_does_not_exist_yet";
|
||||
ucmd.args(&["-s", "8", "-c", filename])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(!at.file_exists(filename));
|
||||
}
|
||||
|
||||
@@ -355,8 +347,7 @@ fn test_new_file_no_create_reference_only() {
|
||||
let filename = "new_file_that_does_not_exist_yet";
|
||||
ucmd.args(&["-r", FILE1, "-c", filename])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(!at.file_exists(filename));
|
||||
}
|
||||
|
||||
@@ -369,8 +360,7 @@ fn test_new_file_no_create_size_and_reference() {
|
||||
let filename = "new_file_that_does_not_exist_yet";
|
||||
ucmd.args(&["-r", FILE1, "-s", "+8", "-c", filename])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
.no_output();
|
||||
assert!(!at.file_exists(filename));
|
||||
}
|
||||
|
||||
@@ -418,10 +408,7 @@ fn test_no_such_dir() {
|
||||
#[test]
|
||||
fn test_underflow_relative_size() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-s-1", FILE1])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
ucmd.args(&["-s-1", FILE1]).succeeds().no_output();
|
||||
assert!(at.file_exists(FILE1));
|
||||
assert!(at.read_bytes(FILE1).is_empty());
|
||||
}
|
||||
@@ -429,10 +416,7 @@ fn test_underflow_relative_size() {
|
||||
#[test]
|
||||
fn test_negative_size_with_space() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-s", "-1", FILE1])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
ucmd.args(&["-s", "-1", FILE1]).succeeds().no_output();
|
||||
assert!(at.file_exists(FILE1));
|
||||
assert!(at.read_bytes(FILE1).is_empty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user