mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-25 17:21:57 -07:00
printer: fix \r\n line terminator handling
This fixes a bug where it was assumed that 'is_suffix' when CRLF handling was enabled mean that '\r\n' was present. But that's not the case, and it is intentional that 'is_suffix' only looks for '\n'. (Which is why #1803 wasn't taken, which tries to fix this by changing 'is_suffix'.) Fixes #1765, Closes #1803
This commit is contained in:
@@ -867,6 +867,16 @@ use B;
|
||||
eqnice!("2\n", cmd.stdout());
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/1765
|
||||
rgtest!(r1765, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create("test", "\n");
|
||||
// We need to add --color=always here to force the failure, since the bad
|
||||
// code path is only triggered when colors are enabled.
|
||||
cmd.args(&[r"x?", "--crlf", "--color", "always"]);
|
||||
|
||||
assert!(!cmd.stdout().is_empty());
|
||||
});
|
||||
|
||||
rgtest!(r1866, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create("test", "foobar\nfoobar\nfoo quux");
|
||||
cmd.args(&[
|
||||
|
Reference in New Issue
Block a user