2020-05-25 17:05:26 +00:00
|
|
|
use crate::common::util::*;
|
2018-04-19 13:20:23 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_hostname() {
|
|
|
|
let ls_default_res = new_ucmd!().succeeds();
|
|
|
|
let ls_short_res = new_ucmd!().arg("-s").succeeds();
|
|
|
|
let ls_domain_res = new_ucmd!().arg("-d").succeeds();
|
|
|
|
|
|
|
|
assert!(ls_default_res.stdout.len() >= ls_short_res.stdout.len());
|
|
|
|
assert!(ls_default_res.stdout.len() >= ls_domain_res.stdout.len());
|
|
|
|
}
|
2020-05-18 21:07:21 +00:00
|
|
|
|
2020-06-14 02:58:56 +00:00
|
|
|
// FixME: fails for "MacOS"
|
|
|
|
#[cfg(not(target_os = "macos"))]
|
2020-05-18 21:07:21 +00:00
|
|
|
#[test]
|
|
|
|
fn test_hostname_ip() {
|
2020-06-13 19:38:43 +00:00
|
|
|
let result = new_ucmd!().arg("-i").run();
|
|
|
|
println!("{:#?}", result);
|
|
|
|
assert!(result.success);
|
2020-05-18 21:07:21 +00:00
|
|
|
assert!(!result.stdout.trim().is_empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_hostname_full() {
|
|
|
|
let result = new_ucmd!().arg("-f").succeeds();
|
|
|
|
assert!(!result.stdout.trim().is_empty());
|
|
|
|
|
|
|
|
let ls_short_res = new_ucmd!().arg("-s").succeeds();
|
|
|
|
assert!(result.stdout.trim().contains(ls_short_res.stdout.trim()));
|
|
|
|
}
|