aboutsummaryrefslogtreecommitdiff
path: root/src/regexp/syntax/parse_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-11-25 12:32:34 -0500
committerBrad Fitzpatrick <bradfitz@golang.org>2015-12-01 22:45:12 +0000
commit0680e9c0c16a7d900e3564e1836b8cb93d962a2b (patch)
treec3d48ad54d9c2b08b70cb62a9c6b49f296210cc1 /src/regexp/syntax/parse_test.go
parent5fc583854f1ce1c95487e5b4e170ca5f32bfca36 (diff)
downloadgo-0680e9c0c16a7d900e3564e1836b8cb93d962a2b.tar.xz
regexp/syntax: fix handling of \Q...\E
It's not a group: must handle the inside as a sequence of literal chars, not a single literal string. That is, \Qab\E+ is the same as ab+, not (ab)+. Fixes #11187. Change-Id: I5406d05ccf7efff3a7f15395bdb0cfb2bd23a8ed Reviewed-on: https://go-review.googlesource.com/17233 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/regexp/syntax/parse_test.go')
-rw-r--r--src/regexp/syntax/parse_test.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/regexp/syntax/parse_test.go b/src/regexp/syntax/parse_test.go
index c4a1117ff8..626ceeadf6 100644
--- a/src/regexp/syntax/parse_test.go
+++ b/src/regexp/syntax/parse_test.go
@@ -144,6 +144,7 @@ var parseTests = []parseTest{
// Test Perl quoted literals
{`\Q+|*?{[\E`, `str{+|*?{[}`},
{`\Q+\E+`, `plus{lit{+}}`},
+ {`\Qab\E+`, `cat{lit{a}plus{lit{b}}}`},
{`\Q\\E`, `lit{\}`},
{`\Q\\\E`, `str{\\}`},
@@ -479,6 +480,7 @@ var invalidRegexps = []string{
`a{100000}`,
`a{100000,}`,
"((((((((((x{2}){2}){2}){2}){2}){2}){2}){2}){2}){2})",
+ `\Q\E*`,
}
var onlyPerl = []string{