mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-05 17:37:03 +00:00
test: Update fuzz tests to use the built-in infrastructure
Go 1.18 supports fuzzing natively, so this patch migrates our fuzzing tests to make use of it.
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
// Fuzz testing for package normalize.
|
||||
|
||||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
package normalize
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
s := string(data)
|
||||
User(s)
|
||||
Domain(s)
|
||||
Addr(s)
|
||||
DomainToUnicode(s)
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -128,3 +128,27 @@ func TestDomainToUnicode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func FuzzUser(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, user string) {
|
||||
User(user)
|
||||
})
|
||||
}
|
||||
|
||||
func FuzzDomain(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, domain string) {
|
||||
Domain(domain)
|
||||
})
|
||||
}
|
||||
|
||||
func FuzzAddr(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, addr string) {
|
||||
Addr(addr)
|
||||
})
|
||||
}
|
||||
|
||||
func FuzzDomainToUnicode(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, addr string) {
|
||||
DomainToUnicode(addr)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ÑAndÚ")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("henryⅣ@throne")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ñandú")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("pé@léa")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("Pingüino")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("henryⅣthrone")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ÑAndÚ")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("péléa")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ñandú")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("Pingüino")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ÑAndÚ")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("henryⅣ@throne")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ñandú")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("pé@léa")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("Pingüino")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("henryⅣthrone")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ÑAndÚ")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("péléa")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("ñandú")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("Pingüino")
|
||||
@@ -1 +0,0 @@
|
||||
ñandú
|
||||
@@ -1 +0,0 @@
|
||||
ÑAndÚ
|
||||
@@ -1 +0,0 @@
|
||||
Pingüino
|
||||
@@ -1 +0,0 @@
|
||||
pé@léa
|
||||
@@ -1 +0,0 @@
|
||||
henryⅣ@throne
|
||||
Reference in New Issue
Block a user