mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 02:07:58 +00:00
Add vendor folder to git
This commit is contained in:
parent
66cf5eaafb
commit
183585f56f
6916 changed files with 2629581 additions and 1 deletions
37
vendor/github.com/emicklei/go-restful/path_expression_test.go
generated
vendored
Normal file
37
vendor/github.com/emicklei/go-restful/path_expression_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package restful
|
||||
|
||||
import "testing"
|
||||
|
||||
var tempregexs = []struct {
|
||||
template, regex string
|
||||
literalCount, varCount int
|
||||
}{
|
||||
{"", "^(/.*)?$", 0, 0},
|
||||
{"/a/{b}/c/", "^/a/([^/]+?)/c(/.*)?$", 2, 1},
|
||||
{"/{a}/{b}/{c-d-e}/", "^/([^/]+?)/([^/]+?)/([^/]+?)(/.*)?$", 0, 3},
|
||||
{"/{p}/abcde", "^/([^/]+?)/abcde(/.*)?$", 5, 1},
|
||||
{"/a/{b:*}", "^/a/(.*)(/.*)?$", 1, 1},
|
||||
{"/a/{b:[a-z]+}", "^/a/([a-z]+)(/.*)?$", 1, 1},
|
||||
}
|
||||
|
||||
func TestTemplateToRegularExpression(t *testing.T) {
|
||||
ok := true
|
||||
for i, fixture := range tempregexs {
|
||||
actual, lCount, vCount, _ := templateToRegularExpression(fixture.template)
|
||||
if actual != fixture.regex {
|
||||
t.Logf("regex mismatch, expected:%v , actual:%v, line:%v\n", fixture.regex, actual, i) // 11 = where the data starts
|
||||
ok = false
|
||||
}
|
||||
if lCount != fixture.literalCount {
|
||||
t.Logf("literal count mismatch, expected:%v , actual:%v, line:%v\n", fixture.literalCount, lCount, i)
|
||||
ok = false
|
||||
}
|
||||
if vCount != fixture.varCount {
|
||||
t.Logf("variable count mismatch, expected:%v , actual:%v, line:%v\n", fixture.varCount, vCount, i)
|
||||
ok = false
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
t.Fatal("one or more expression did not match")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue