summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2021-05-30 11:13:27 -0400
committerAndrew Gallant <jamslam@gmail.com>2021-05-31 21:51:18 -0400
commit12dd455ee9aa731acfeb0d2dfed568a0103cae73 (patch)
treebfc7ace9721b67e4891600753f2f4657ed9594c7 /tests
parente6cac8b119d0d50646b3ba1aaf53e648c779901a (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/regression.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regression.rs b/tests/regression.rs
index 1c2b5c15..2ecd2399 100644
--- a/tests/regression.rs
+++ b/tests/regression.rs
@@ -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(&[