diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-10-10 22:04:29 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-10-10 22:04:29 -0400 |
commit | 4737326ed3e0d0a328dafcce9b8d4375ff142460 (patch) | |
tree | ad4877310a598174547518eb2aed7fcdd4734b0b /tests | |
parent | a3537aa32a9069c0d740931010de32f0f184583f (diff) |
Update regex-syntax for bug fix.
The bug fix was in expression pretty printing. ripgrep parses the regex
into an AST and may do some modifications to it, which requires the
ability to go from string -> AST -> string' -> AST' where string == string'
implies AST == AST'.
Also, add a regression test for the specific regex that tripped the bug.
Fixes #156.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 032bae00..d6fe35d2 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -809,6 +809,34 @@ sym2:be, to a very large extent, the result of luck. Sherlock Holmes assert_eq!(lines, path(expected)); }); +// See: https://github.com/BurntSushi/ripgrep/issues/156 +clean!( + regression_156, + r#"#(?:parse|include)\s*\(\s*(?:"|')[./A-Za-z_-]+(?:"|')"#, + "testcase.txt", +|wd: WorkDir, mut cmd: Command| { + const TESTCASE: &'static str = r#"#parse('widgets/foo_bar_macros.vm') +#parse ( 'widgets/mobile/foo_bar_macros.vm' ) +#parse ("widgets/foobarhiddenformfields.vm") +#parse ( "widgets/foo_bar_legal.vm" ) +#include( 'widgets/foo_bar_tips.vm' ) +#include('widgets/mobile/foo_bar_macros.vm') +#include ("widgets/mobile/foo_bar_resetpw.vm") +#parse('widgets/foo-bar-macros.vm') +#parse ( 'widgets/mobile/foo-bar-macros.vm' ) +#parse ("widgets/foo-bar-hiddenformfields.vm") +#parse ( "widgets/foo-bar-legal.vm" ) +#include( 'widgets/foo-bar-tips.vm' ) +#include('widgets/mobile/foo-bar-macros.vm') +#include ("widgets/mobile/foo-bar-resetpw.vm") +"#; + wd.create("testcase.txt", TESTCASE); + cmd.arg("-N"); + + let lines: String = wd.stdout(&mut cmd); + assert_eq!(lines, TESTCASE); +}); + // See: https://github.com/BurntSushi/ripgrep/issues/20 sherlock!(feature_20_no_filename, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { |