coreutils/tests/by-util/test_stty.rs
2023-08-21 10:49:27 +02:00

65 lines
1.6 KiB
Rust

// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore parenb parmrk ixany iuclc onlcr ofdel icanon noflsh
use crate::common::util::TestScenario;
#[test]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}
#[test]
#[ignore = "Fails because cargo test does not run in a tty"]
fn runs() {
new_ucmd!().succeeds();
}
#[test]
#[ignore = "Fails because cargo test does not run in a tty"]
fn print_all() {
let res = new_ucmd!().succeeds();
// Random selection of flags to check for
for flag in [
"parenb", "parmrk", "ixany", "iuclc", "onlcr", "ofdel", "icanon", "noflsh",
] {
res.stdout_contains(flag);
}
}
#[test]
fn save_and_setting() {
new_ucmd!()
.args(&["--save", "nl0"])
.fails()
.stderr_contains("when specifying an output style, modes may not be set");
}
#[test]
fn all_and_setting() {
new_ucmd!()
.args(&["--all", "nl0"])
.fails()
.stderr_contains("when specifying an output style, modes may not be set");
}
#[test]
fn save_and_all() {
new_ucmd!()
.args(&["--save", "--all"])
.fails()
.stderr_contains(
"the options for verbose and stty-readable output styles are mutually exclusive",
);
new_ucmd!()
.args(&["--all", "--save"])
.fails()
.stderr_contains(
"the options for verbose and stty-readable output styles are mutually exclusive",
);
}