From 4c1774e918f41b71a44532535afc81bbe246580d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 1 May 2020 00:24:06 +0200 Subject: [PATCH 1/2] test(uname): Add uname tests --- GNUmakefile | 1 + tests/test_uname.rs | 17 +++++++++++++++++ tests/tests.rs | 1 + 3 files changed, 19 insertions(+) create mode 100644 tests/test_uname.rs diff --git a/GNUmakefile b/GNUmakefile index a0c817289..64ceaa5c2 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -205,6 +205,7 @@ TEST_PROGS := \ true \ truncate \ tsort \ + uname \ unexpand \ uniq \ unlink \ diff --git a/tests/test_uname.rs b/tests/test_uname.rs new file mode 100644 index 000000000..b9504b7fc --- /dev/null +++ b/tests/test_uname.rs @@ -0,0 +1,17 @@ +use common::util::*; + +#[test] +fn test_uname_compatible() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("-a").run(); + assert!(result.success); +} + +#[test] +fn test_uname_name() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("-n").run(); + assert!(result.success); +} diff --git a/tests/tests.rs b/tests/tests.rs index 82c681608..4546af1d0 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -29,6 +29,7 @@ unix_only! { "pathchk", test_pathchk; "pinky", test_pinky; "stdbuf", test_stdbuf; + "uname", test_uname; "unlink", test_unlink; "who", test_who; // Be aware of the trailing semicolon after the last item From dfb36897ccdeb7325effc1d250f2f31ec902674e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 1 May 2020 13:39:09 +0200 Subject: [PATCH 2/2] docs(cargo): explain that platform specific tests aren't executed by default --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 12e47747e..d22dd83da 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,12 @@ Cargo: $ cargo test ``` +By default, `cargo test` only runs the common programs. To run also platform +specific tests, run: +```bash +$ cargo test --features unix +``` + If you would prefer to test a select few utilities: ```bash $ cargo test --features "chmod mv tail" --no-default-features