From ed901854df41f52c05e3aea641abcb7f490afb6c Mon Sep 17 00:00:00 2001 From: Valerio <83879763+valerioedu@users.noreply.github.com> Date: Sat, 22 Mar 2025 02:18:23 +0100 Subject: [PATCH 1/3] Add test to ensure arch output is not empty This test ensures that the output of the arch command is non-empty, which is a minimal expectation across all supported architectures. This helps avoid regressions or edge cases where the command might unexpectedly return an empty string on unsupported or misconfigured platforms. --- tests/by-util/test_arch.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/by-util/test_arch.rs b/tests/by-util/test_arch.rs index 672d223e0f5..903010fac31 100644 --- a/tests/by-util/test_arch.rs +++ b/tests/by-util/test_arch.rs @@ -21,3 +21,10 @@ fn test_arch_help() { fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails_with_code(1); } + +#[test] +fn test_arch_output_is_not_empty() { + let result = new_ucmd!().run(); + result.success(); + assert!(!result.stdout_str().trim().is_empty(), "arch output was empty"); +} From 2f196011e498d0bafa0faf77a5761e459c084468 Mon Sep 17 00:00:00 2001 From: Valerio <83879763+valerioedu@users.noreply.github.com> Date: Sat, 22 Mar 2025 14:25:38 +0100 Subject: [PATCH 2/3] Update tests/by-util/test_arch.rs Co-authored-by: Daniel Hofstetter --- tests/by-util/test_arch.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/by-util/test_arch.rs b/tests/by-util/test_arch.rs index 903010fac31..307a17d9239 100644 --- a/tests/by-util/test_arch.rs +++ b/tests/by-util/test_arch.rs @@ -24,7 +24,6 @@ fn test_invalid_arg() { #[test] fn test_arch_output_is_not_empty() { - let result = new_ucmd!().run(); - result.success(); + let result = new_ucmd!().succeeds(); assert!(!result.stdout_str().trim().is_empty(), "arch output was empty"); } From 8d10e795c7aa647ad298add604e75a5dc0ad936a Mon Sep 17 00:00:00 2001 From: valerioedu Date: Sat, 22 Mar 2025 14:37:30 +0100 Subject: [PATCH 3/3] Apply cargo fmt formatting --- tests/by-util/test_arch.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_arch.rs b/tests/by-util/test_arch.rs index 307a17d9239..2486f3d4857 100644 --- a/tests/by-util/test_arch.rs +++ b/tests/by-util/test_arch.rs @@ -25,5 +25,8 @@ fn test_invalid_arg() { #[test] fn test_arch_output_is_not_empty() { let result = new_ucmd!().succeeds(); - assert!(!result.stdout_str().trim().is_empty(), "arch output was empty"); + assert!( + !result.stdout_str().trim().is_empty(), + "arch output was empty" + ); }