Skip to content

Commit

Permalink
Fix fuzzing after MSSQL (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg authored Apr 24, 2024
1 parent 90ff4ef commit b8fd0b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions builq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ func TestBuilder(t *testing.T) {
func FuzzBuilder(f *testing.F) {
f.Add("SELECT %s FROM %s", "*", "users")
f.Add("SELECT * FROM %s WHERE name = %$", "users", "john")
f.Add("SELECT * FROM users WHERE name = %$ AND surname = %$", "john", "doe")
f.Add("WHERE name = %$ AND surname = %$", "john", "doe")
f.Add("%s WHERE %? == name", "TEST", "john")
f.Add("%s WHERE %@ = surname", "TEST", "doe")

f.Fuzz(func(t *testing.T, format, arg1, arg2 string) {
var valid int
for _, verb := range []string{"%s", "%$", "%?"} {
for _, verb := range []string{"%s", "%d", "%$", "%?", "%@"} {
valid += strings.Count(format, verb)
}
if valid != 2 {
Expand Down

0 comments on commit b8fd0b5

Please sign in to comment.