summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBalaji Sivaraman <balaji@balajisivaraman.com>2018-01-01 21:54:46 +0530
committerAndrew Gallant <jamslam@gmail.com>2018-01-01 11:24:46 -0500
commit14779ed0ea5d28aaa6c04dff3be77989f9fd2836 (patch)
treeb71bd233b0a8592e1a645afad62e411b469b8bec /tests
parentb6177f0459044a7e3fb882ecda9c80e44e4d95de (diff)
ux: suggest --fixed-strings flag
If a regex syntax error occurs, then ripgrep will suggest using the --fixed-strings flag. Fixes #727
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 152eca30..4bd852cd 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -1599,6 +1599,16 @@ sherlock!(feature_419_zero_as_shortcut_for_null, "Sherlock", ".",
assert_eq!(lines, "sherlock\x002\n");
});
+// See: https://github.com/BurntSushi/ripgrep/issues/709
+clean!(suggest_fixed_strings_for_invalid_regex, "foo(", ".",
+|wd: WorkDir, mut cmd: Command| {
+ wd.assert_non_empty_stderr(&mut cmd);
+
+ let output = cmd.output().unwrap();
+ let err = String::from_utf8_lossy(&output.stderr);
+ assert_eq!(err.contains("--fixed-strings"), true);
+});
+
#[test]
fn binary_nosearch() {
let wd = WorkDir::new("binary_nosearch");