Skip to content

Commit

Permalink
tests/more: test argument --from-line
Browse files Browse the repository at this point in the history
  • Loading branch information
Ideflop committed Jun 26, 2023
1 parent 77f8201 commit c4c3a35
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/by-util/test_more.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c4c3a35

Please sign in to comment.