mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests/more: test argument --from-line
This commit is contained in:
parent
77f8201fb8
commit
c4c3a354f8
1 changed files with 34 additions and 0 deletions
|
@ -45,6 +45,40 @@ fn test_invalid_arg() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_argument_from_file() {
|
||||
if std::io::stdout().is_terminal() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
let file = "test_file";
|
||||
|
||||
at.write(file, "1\n2");
|
||||
|
||||
// output all lines
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-F")
|
||||
.arg("0")
|
||||
.arg(file)
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_contains("1")
|
||||
.stdout_contains("2");
|
||||
|
||||
// output only the second line
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-F")
|
||||
.arg("2")
|
||||
.arg(file)
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_contains("2")
|
||||
.stdout_does_not_contain("1");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_more_dir_arg() {
|
||||
// Run the test only if there's a valid terminal, else do nothing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue