Added a test for path parsing and benchmarks for newPath and newServePath.
This commit is contained in:
parent
c237f8c566
commit
3e6d03db1a
@ -124,3 +124,33 @@ func TestSubPaths(t *testing.T) {
|
||||
t.Error(found, "Path", p, "should return 404")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathParsing(t *testing.T) {
|
||||
p, err := newPath("/api/v1/../.")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(p)
|
||||
}
|
||||
|
||||
const testStr = "/api/v1/foo/bar/baz/abc/def/fucc/b0y/of/a/local/dungeon/master/got/his/ass/fisted/for/free/and/he/was/absolutely/happy/with/that/"
|
||||
|
||||
func BenchmarkPatternPathParsing(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
p, err := newPath(testStr)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.Log(len(p))
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkServePathParsing(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
p, err := newServePath(testStr)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.Log(len(p))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user