Uses the variadic function.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
This commit is contained in:
Cyril Tovena 2021-10-05 15:59:40 +02:00
parent 623c3ebeec
commit 639cd00721
No known key found for this signature in database
GPG key ID: FD8F768F9D633FB6
2 changed files with 2 additions and 3 deletions

View file

@ -115,9 +115,7 @@ func findSetMatchesFromConcat(re *syntax.Regexp, base string) []string {
if len(re.Sub) == 0 {
return nil
}
for _, sub := range re.Sub {
clearCapture(sub)
}
clearCapture(re.Sub...)
matches := findSetMatches(re.Sub[0], base)
if matches == nil {
return nil

View file

@ -116,6 +116,7 @@ func TestFindSetMatches(t *testing.T) {
{"bar|b|buzz", []string{"bar", "b", "buzz"}},
// Simple sets containing escaped characters.
{"fo\\.o|bar\\?|\\^baz", []string{"fo.o", "bar?", "^baz"}},
// using charclass
{"[abc]d", []string{"ad", "bd", "cd"}},
// high low charset different => A(B[CD]|EF)|BC[XY]
{"ABC|ABD|AEF|BCX|BCY", []string{"ABC", "ABD", "AEF", "BCX", "BCY"}},