coreutils/tests/test_who.rs

73 lines
1.5 KiB
Rust
Raw Normal View History

2016-08-11 07:37:39 +00:00
use common::util::*;
2016-08-11 07:37:39 +00:00
#[cfg(target_os = "linux")]
#[test]
fn test_count() {
for opt in vec!["-q", "--count"] {
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() {
for opt in vec!["-b", "--boot"] {
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() {
for opt in vec!["-H"] {
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() {
for opt in vec!["-s", "--short"] {
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() {
for opt in vec!["-l", "--login"] {
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() {
for opt in vec!["-m"] {
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() {
for opt in vec!["-d", "--dead"] {
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() {
for opt in vec!["-a", "--all"] {
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
2016-08-11 07:37:39 +00:00
}
}
#[cfg(target_os = "linux")]
fn expected_result(arg: &str) -> String {
TestScenario::new(util_name!()).cmd_keepenv(util_name!()).env("LANGUAGE", "C").args(&[arg]).run().stdout
2016-08-11 07:37:39 +00:00
}