mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests/util: Improve UChild. Cleanup redundant functions in util.rs.
A short summary of changes: * Add some basic tests for UChild and the run methods. * Try more often in a fixed interval to create the tempfile for CapturedOutput. * Fix drop order of struct fields for better cleanup of temporary files/dirs. * Mark UChild::wait_with_output and UChild::pipe_in_and_wait_with_output deprecated * Make CapturedOutput private * Panic in stdout_all, stdout_all_bytes etc. if output is not captured. * Rename some methods, refactor, clean up, fix documentation, add try_... methods
This commit is contained in:
parent
982fb682e9
commit
4f54eedb74
5 changed files with 549 additions and 278 deletions
|
@ -374,12 +374,12 @@ fn test_rm_descend_directory() {
|
|||
at.touch(file_2);
|
||||
|
||||
let mut child = scene.ucmd().arg("-ri").arg("a").run_no_wait();
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
|
||||
child.wait().unwrap();
|
||||
|
||||
|
@ -447,7 +447,7 @@ fn test_rm_prompts() {
|
|||
|
||||
let mut child = scene.ucmd().arg("-ri").arg("a").run_no_wait();
|
||||
for _ in 0..9 {
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
}
|
||||
|
||||
let result = child.wait().unwrap();
|
||||
|
@ -487,7 +487,7 @@ fn test_rm_force_prompts_order() {
|
|||
|
||||
// This should cause rm to prompt to remove regular empty file
|
||||
let mut child = scene.ucmd().arg("-fi").arg(empty_file).run_no_wait();
|
||||
child.write_in(yes.as_bytes()).unwrap();
|
||||
child.try_write_in(yes.as_bytes()).unwrap();
|
||||
|
||||
let result = child.wait().unwrap();
|
||||
let string_output = result.stderr_str();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue