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/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 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 1c44a3e14..5bd0f0f05 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