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

tests: replace run() with succeeds() or fails()

This commit is contained in:
Daniel Hofstetter 2025-03-09 16:53:56 +01:00
parent 3844a74c38
commit df4dfea852
39 changed files with 434 additions and 498 deletions

View file

@ -31,7 +31,7 @@ fn test_resolve() {
#[test]
fn test_canonicalize() {
let (at, mut ucmd) = at_and_ucmd!();
let actual = ucmd.arg("-f").arg(".").run().stdout_move_str();
let actual = ucmd.arg("-f").arg(".").succeeds().stdout_move_str();
let expect = at.root_dir_resolved() + "\n";
println!("actual: {actual:?}");
println!("expect: {expect:?}");
@ -41,7 +41,7 @@ fn test_canonicalize() {
#[test]
fn test_canonicalize_existing() {
let (at, mut ucmd) = at_and_ucmd!();
let actual = ucmd.arg("-e").arg(".").run().stdout_move_str();
let actual = ucmd.arg("-e").arg(".").succeeds().stdout_move_str();
let expect = at.root_dir_resolved() + "\n";
println!("actual: {actual:?}");
println!("expect: {expect:?}");
@ -51,7 +51,7 @@ fn test_canonicalize_existing() {
#[test]
fn test_canonicalize_missing() {
let (at, mut ucmd) = at_and_ucmd!();
let actual = ucmd.arg("-m").arg(GIBBERISH).run().stdout_move_str();
let actual = ucmd.arg("-m").arg(GIBBERISH).succeeds().stdout_move_str();
let expect = path_concat!(at.root_dir_resolved(), GIBBERISH) + "\n";
println!("actual: {actual:?}");
println!("expect: {expect:?}");
@ -63,7 +63,12 @@ fn test_long_redirection_to_current_dir() {
let (at, mut ucmd) = at_and_ucmd!();
// Create a 256-character path to current directory
let dir = path_concat!(".", ..128);
let actual = ucmd.arg("-n").arg("-m").arg(dir).run().stdout_move_str();
let actual = ucmd
.arg("-n")
.arg("-m")
.arg(dir)
.succeeds()
.stdout_move_str();
let expect = at.root_dir_resolved();
println!("actual: {actual:?}");
println!("expect: {expect:?}");
@ -78,7 +83,7 @@ fn test_long_redirection_to_root() {
.arg("-n")
.arg("-m")
.arg(dir)
.run()
.succeeds()
.stdout_move_str();
let expect = get_root_path();
println!("actual: {actual:?}");