Add internal engine relocation candidate
This commit is contained in:
27
internal/engine/path_fuzz_test.go
Normal file
27
internal/engine/path_fuzz_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package engine
|
||||
|
||||
import "testing"
|
||||
|
||||
func FuzzParsePath(f *testing.F) {
|
||||
for _, seed := range []string{"", "/", "/service/port", "/a~1b/~0key", "/0", "relative", "/bad~2escape"} {
|
||||
f.Add(seed)
|
||||
}
|
||||
|
||||
f.Fuzz(func(t *testing.T, input string) {
|
||||
if len(input) > 4096 {
|
||||
return
|
||||
}
|
||||
path, err := ParsePath(input)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
canonical := path.String()
|
||||
reparsed, err := ParsePath(canonical)
|
||||
if err != nil {
|
||||
t.Fatalf("canonical path %q did not parse: %v", canonical, err)
|
||||
}
|
||||
if reparsed.String() != canonical {
|
||||
t.Fatalf("path round trip = %q, want %q", reparsed.String(), canonical)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user