2020-05-25 17:05:26 +00:00
|
|
|
use crate::common::util::*;
|
2022-02-01 11:19:00 +00:00
|
|
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
|
|
|
|
use std::fs::OpenOptions;
|
2015-11-16 05:25:01 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_exit_code() {
|
2016-08-23 11:52:43 +00:00
|
|
|
new_ucmd!().fails();
|
2015-11-16 05:25:01 +00:00
|
|
|
}
|
2022-02-01 11:19:00 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_version() {
|
|
|
|
new_ucmd!()
|
|
|
|
.args(&["--version"])
|
|
|
|
.fails()
|
|
|
|
.stdout_contains("false");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_help() {
|
|
|
|
new_ucmd!()
|
|
|
|
.args(&["--help"])
|
|
|
|
.fails()
|
|
|
|
.stdout_contains("false");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_short_options() {
|
2022-02-01 13:29:26 +00:00
|
|
|
for option in ["-h", "-V"] {
|
2022-02-01 11:19:00 +00:00
|
|
|
new_ucmd!().arg(option).fails().stdout_is("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-01 13:29:26 +00:00
|
|
|
#[test]
|
|
|
|
fn test_conflict() {
|
|
|
|
new_ucmd!()
|
|
|
|
.args(&["--help", "--version"])
|
|
|
|
.fails()
|
|
|
|
.stdout_is("");
|
|
|
|
}
|
|
|
|
|
2022-02-01 11:19:00 +00:00
|
|
|
#[test]
|
|
|
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
|
|
|
|
fn test_full() {
|
|
|
|
for option in ["--version", "--help"] {
|
|
|
|
let dev_full = OpenOptions::new().write(true).open("/dev/full").unwrap();
|
|
|
|
|
|
|
|
new_ucmd!()
|
|
|
|
.arg(option)
|
|
|
|
.set_stdout(dev_full)
|
|
|
|
.fails()
|
|
|
|
.stderr_contains("No space left on device");
|
|
|
|
}
|
|
|
|
}
|