From 16bf4b189317f51c9589bf4b858cf8bb1d8c1f37 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 5 May 2020 23:08:58 +0200 Subject: [PATCH 1/2] test(arch): Add some tests --- src/uu/arch/src/arch.rs | 2 +- tests/test_arch.rs | 18 ++++++++++++++++++ tests/tests.rs | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/test_arch.rs diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index d27b5d216..3f822f75c 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -15,7 +15,7 @@ extern crate uucore; use platform_info::*; -static SYNTAX: &str = ""; +static SYNTAX: &str = "Print machine architecture"; static SUMMARY: &str = "Determine architecture name for current machine."; static LONG_HELP: &str = ""; diff --git a/tests/test_arch.rs b/tests/test_arch.rs new file mode 100644 index 000000000..f5bc3b1e4 --- /dev/null +++ b/tests/test_arch.rs @@ -0,0 +1,18 @@ +use common::util::*; + +#[test] +fn test_arch() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.run(); + assert!(result.success); +} + +#[test] +fn test_arch_help() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("--help").run(); + assert!(result.success); + assert!(result.stdout.contains("architecture name")); +} diff --git a/tests/tests.rs b/tests/tests.rs index be8ae7dd2..f52638ae6 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -46,6 +46,7 @@ macro_rules! generic { }; } generic! { + "arch", test_arch; "base32", test_base32; "base64", test_base64; "basename", test_basename; From 1565f4d1d94b4ccf1b6c0d3ae9023536f722dedb Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 10 May 2020 21:05:38 +0200 Subject: [PATCH 2/2] Update src/uu/arch/src/arch.rs Co-authored-by: Roy Ivy III --- src/uu/arch/src/arch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index 3f822f75c..ced3d6e97 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -15,7 +15,7 @@ extern crate uucore; use platform_info::*; -static SYNTAX: &str = "Print machine architecture"; +static SYNTAX: &str = "Display machine architecture"; static SUMMARY: &str = "Determine architecture name for current machine."; static LONG_HELP: &str = "";