Skip to content

Commit f0e0852

Browse files
author
João Veiga
committed
add fuzzing for schema and query parsing
1 parent 21d1871 commit f0e0852

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

go.mod

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module github.com/graph-gophers/graphql-go
22

3-
require github.com/opentracing/opentracing-go v1.1.0
3+
require (
4+
github.com/opentracing/opentracing-go v1.1.0
5+
github.com/stretchr/testify v1.3.0 // indirect
6+
)
47

58
go 1.13

go.sum

+7
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
13
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
24
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
5+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
8+
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
9+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=

internal/query/query_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package query
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func FuzzParseQuery(f *testing.F) {
8+
f.Fuzz(func(t *testing.T, queryStr string) {
9+
Parse(queryStr)
10+
})
11+
}
12+

internal/schema/schema_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -1007,3 +1007,10 @@ func TestInterfaceImplementsInterface(t *testing.T) {
10071007
})
10081008
}
10091009
}
1010+
1011+
func FuzzParse(f *testing.F){
1012+
f.Fuzz(func(t *testing.T, schemaString string, useStringDescriptions bool){
1013+
s := schema.New()
1014+
schema.Parse(s, schemaString, useStringDescriptions)
1015+
})
1016+
}

0 commit comments

Comments
 (0)