Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/test_grep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,23 @@ fn only_matching() {
.succeeds()
.stdout_only("Hello\nhELLO\nHELLO\n");

// Zero-width matches do not print in -o mode, but still mark the line as
// matched. This matters for -v because matched lines must not be selected.
let (_s, mut c) = ucmd();
c.args(&["-o", "$"]).pipe_in("\n").succeeds().no_output();

let (_s, mut c) = ucmd();
c.args(&["-o", "-v", "$"])
.pipe_in("a\n\nb\n")
.fails_with_code(1)
.no_output();

let (_s, mut c) = ucmd();
c.args(&["-o", "-v", "x*"])
.pipe_in("a\n\nb\n")
.fails_with_code(1)
.no_output();

// After a match ends, ^ must not re-match at that position.
let (_s, mut c) = ucmd();
c.args(&["-o", "^hello*"])
Expand Down
Loading