summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2019-01-25 17:18:57 -0500
committerAndrew Gallant <jamslam@gmail.com>2019-01-25 17:18:57 -0500
commit276e2c9b9ab3dac7643033d8b9d6c272d5dac1d5 (patch)
tree781a5da81a73e541d869accfcdce15e5df518de3 /tests
parent9a9f54d44ce45c6c3c5bfa31ad1a08fda57cdad7 (diff)
searcher: always strip BOM
This fixes a bug where a BOM prefix was included. While this was somewhat intentional in order to have a faithful "UTF8 passthru" option, in practice, this causes problems such as breaking patterns like `^` in a really non-obvious way. The actual fix was to add a new API to encoding_rs_io, which this commit brings in. Fixes #1163
Diffstat (limited to 'tests')
-rw-r--r--tests/regression.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regression.rs b/tests/regression.rs
index b8dc26d0..15dbcad7 100644
--- a/tests/regression.rs
+++ b/tests/regression.rs
@@ -592,6 +592,15 @@ rgtest!(r1130, |dir: Dir, mut cmd: TestCommand| {
);
});
+// See: https://github.com/BurntSushi/ripgrep/issues/1163
+rgtest!(r1163, |dir: Dir, mut cmd: TestCommand| {
+ dir.create("bom.txt", "\u{FEFF}test123\ntest123");
+ eqnice!(
+ "bom.txt:test123\nbom.txt:test123\n",
+ cmd.arg("^test123").stdout()
+ );
+});
+
// See: https://github.com/BurntSushi/ripgrep/issues/1164
rgtest!(r1164, |dir: Dir, mut cmd: TestCommand| {
dir.create_dir(".git");