test(uptime): Add a test (#1512)

This commit is contained in:
Sylvestre Ledru 2020-05-16 00:14:54 +02:00 committed by Roy Ivy III
parent 601690b079
commit 2c90932ec0
2 changed files with 15 additions and 0 deletions

14
tests/test_uptime.rs Normal file
View file

@ -0,0 +1,14 @@
use common::util::*;
#[test]
fn test_uptime() {
let result = TestScenario::new(util_name!()).ucmd_keepenv().run();
println!("stdout = {}", result.stdout);
println!("stderr = {}", result.stderr);
assert!(result.success);
assert!(result.stdout.contains("load average:"));
assert!(result.stdout.contains(" up "));
// Don't check for users as it doesn't show in some CI
}

View file

@ -31,6 +31,7 @@ unix_only! {
"stdbuf", test_stdbuf;
"uname", test_uname;
"unlink", test_unlink;
"uptime", test_uptime;
"users", test_users;
"who", test_who;
// Be aware of the trailing semicolon after the last item