2016-08-11 07:37:39 +00:00
|
|
|
use common::util::*;
|
|
|
|
|
|
|
|
|
2016-08-13 21:59:21 +00:00
|
|
|
|
2016-08-11 07:37:39 +00:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_count() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-q", "--count"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_boot() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-b", "--boot"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_heading() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-H"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_short() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-s", "--short"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_login() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-l", "--login"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_m() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-m"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_dead() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-d", "--dead"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn test_all() {
|
2016-08-13 21:59:21 +00:00
|
|
|
for opt in vec!["-a", "--all"] {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
2016-08-13 21:59:21 +00:00
|
|
|
fn expected_result(arg: &str) -> String {
|
2016-08-23 11:52:43 +00:00
|
|
|
TestScenario::new(util_name!()).cmd_keepenv(util_name!()).args(&[arg]).run().stdout
|
2016-08-11 07:37:39 +00:00
|
|
|
}
|