coreutils/tests/test_hostname.rs
Alex Jiang 58b4075566 hostname: bug fix for non-windows xgethostname and add test case
Cstr::from_bytes_with_nul needs input bytes null terminated. Current
version does not include the last null byte, hence
Cstr::from_bytes_with_nul will panic with error 'FromBytesWithNulError {
kind: NotNulTerminated }'
2018-04-22 21:04:51 +08:00

12 lines
362 B
Rust

use common::util::*;
#[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());
}