2020-05-25 17:05:26 +00:00
|
|
|
use crate::common::util::*;
|
2020-05-11 08:44:12 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_more_no_arg() {
|
2021-04-24 17:02:03 +00:00
|
|
|
// Reading from stdin is now supported, so this must succeed
|
|
|
|
if atty::is(atty::Stream::Stdout) {
|
|
|
|
new_ucmd!().succeeds();
|
2021-05-31 03:55:28 +00:00
|
|
|
} else {
|
|
|
|
}
|
2020-05-11 08:44:12 +00:00
|
|
|
}
|
2021-04-02 20:34:02 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_more_dir_arg() {
|
2021-05-30 05:10:54 +00:00
|
|
|
// Run the test only if there's a valid terminal, else do nothing
|
2021-04-24 17:02:03 +00:00
|
|
|
// Maybe we could capture the error, i.e. "Device not found" in that case
|
|
|
|
// but I am leaving this for later
|
|
|
|
if atty::is(atty::Stream::Stdout) {
|
2021-07-27 05:21:12 +00:00
|
|
|
let ts = TestScenario::new(util_name!());
|
|
|
|
let result = ts.ucmd().arg(".").run();
|
2021-04-24 17:02:03 +00:00
|
|
|
result.failure();
|
2021-07-27 05:21:12 +00:00
|
|
|
let expected_error_message = &format!(
|
2021-08-14 15:21:18 +00:00
|
|
|
"{0}: '.' is a directory.\nTry '{1} {0} --help' for more information.",
|
2021-07-27 05:21:12 +00:00
|
|
|
ts.util_name,
|
|
|
|
ts.bin_path.to_string_lossy()
|
|
|
|
);
|
|
|
|
assert_eq!(result.stderr_str().trim(), expected_error_message);
|
2021-05-31 03:55:28 +00:00
|
|
|
} else {
|
|
|
|
}
|
2021-04-02 20:34:02 +00:00
|
|
|
}
|