mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Uses the variadic function.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
This commit is contained in:
parent
623c3ebeec
commit
639cd00721
|
@ -115,9 +115,7 @@ func findSetMatchesFromConcat(re *syntax.Regexp, base string) []string {
|
||||||
if len(re.Sub) == 0 {
|
if len(re.Sub) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
for _, sub := range re.Sub {
|
clearCapture(re.Sub...)
|
||||||
clearCapture(sub)
|
|
||||||
}
|
|
||||||
matches := findSetMatches(re.Sub[0], base)
|
matches := findSetMatches(re.Sub[0], base)
|
||||||
if matches == nil {
|
if matches == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -116,6 +116,7 @@ func TestFindSetMatches(t *testing.T) {
|
||||||
{"bar|b|buzz", []string{"bar", "b", "buzz"}},
|
{"bar|b|buzz", []string{"bar", "b", "buzz"}},
|
||||||
// Simple sets containing escaped characters.
|
// Simple sets containing escaped characters.
|
||||||
{"fo\\.o|bar\\?|\\^baz", []string{"fo.o", "bar?", "^baz"}},
|
{"fo\\.o|bar\\?|\\^baz", []string{"fo.o", "bar?", "^baz"}},
|
||||||
|
// using charclass
|
||||||
{"[abc]d", []string{"ad", "bd", "cd"}},
|
{"[abc]d", []string{"ad", "bd", "cd"}},
|
||||||
// high low charset different => A(B[CD]|EF)|BC[XY]
|
// high low charset different => A(B[CD]|EF)|BC[XY]
|
||||||
{"ABC|ABD|AEF|BCX|BCY", []string{"ABC", "ABD", "AEF", "BCX", "BCY"}},
|
{"ABC|ABD|AEF|BCX|BCY", []string{"ABC", "ABD", "AEF", "BCX", "BCY"}},
|
||||||
|
|
Loading…
Reference in a new issue