From a2e6aec7a4d9382941932245e8854f0ae5703a5e Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Thu, 23 Apr 2020 08:36:54 -0400 Subject: [PATCH] tests: add new regression test for fixed inner literal bug This adds a new test case for a bug (#1537) that has already been fixed. Or more precisely, a new bug with the same root cause. Closes #1559 --- tests/regression.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/regression.rs b/tests/regression.rs index 6cdf8b9..1bfd4f0 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -799,3 +799,26 @@ rgtest!(r1537, |dir: Dir, mut cmd: TestCommand| { let expected = "foo:abc;de,fg\n"; eqnice!(expected, cmd.arg(";(.*,){1}").stdout()); }); + +// See: https://github.com/BurntSushi/ripgrep/issues/1559 +rgtest!(r1559, |dir: Dir, mut cmd: TestCommand| { + dir.create( + "foo", + "\ +type A struct { + TaskID int `json:\"taskID\"` +} + +type B struct { + ObjectID string `json:\"objectID\"` + TaskID int `json:\"taskID\"` +} +", + ); + + let expected = "\ +foo: TaskID int `json:\"taskID\"` +foo: TaskID int `json:\"taskID\"` +"; + eqnice!(expected, cmd.arg("TaskID +int").stdout()); +});