summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2019-04-14 17:39:37 -0400
committerAndrew Gallant <jamslam@gmail.com>2019-04-14 19:29:27 -0400
commit967e7ad0de3e657e8f81c1384a48ca1eea4edde7 (patch)
treecabe8250acf34508fc60724104fa05bbcd257295 /tests
parent9952ba2068bd0f9baf74a2094d0d1db493b71180 (diff)
ripgrep: add --auto-hybrid-regex flag
This flag, when set, will automatically dispatch to PCRE2 if the given regex cannot be compiled by Rust's regex engine. If both engines fail to compile the regex, then both errors are surfaced. Closes #1155
Diffstat (limited to 'tests')
-rw-r--r--tests/feature.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/feature.rs b/tests/feature.rs
index 6ee2bf87..be9f4bec 100644
--- a/tests/feature.rs
+++ b/tests/feature.rs
@@ -681,6 +681,21 @@ rgtest!(f1138_no_ignore_dot, |dir: Dir, mut cmd: TestCommand| {
eqnice!("bar\n", cmd.arg("--ignore-file").arg(".fzf-ignore").stdout());
});
+// See: https://github.com/BurntSushi/ripgrep/issues/1155
+rgtest!(f1155_auto_hybrid_regex, |dir: Dir, mut cmd: TestCommand| {
+ // No sense in testing a hybrid regex engine with only one engine!
+ if !dir.is_pcre2() {
+ return;
+ }
+
+ dir.create("sherlock", SHERLOCK);
+ cmd.arg("--no-pcre2").arg("--auto-hybrid-regex").arg(r"(?<=the )Sherlock");
+
+ let expected = "\
+sherlock:For the Doctor Watsons of this world, as opposed to the Sherlock
+";
+ eqnice!(expected, cmd.stdout());
+});
// See: https://github.com/BurntSushi/ripgrep/issues/1207
//