@@ -24,9 +24,7 @@ func TestSlicePointerBinding(t *testing.T) {
2424 })
2525
2626 ta , err := binder .TypeReference (schema .Query .Fields .ForName ("messages" ).Type , nil )
27- if err != nil {
28- panic (err )
29- }
27+ require .NoError (t , err )
3028
3129 require .Equal (t , "[]*github.com/99designs/gqlgen/codegen/config/testdata/autobinding/chat.Message" , ta .GO .String ())
3230 })
@@ -37,9 +35,7 @@ func TestSlicePointerBinding(t *testing.T) {
3735 })
3836
3937 ta , err := binder .TypeReference (schema .Query .Fields .ForName ("messages" ).Type , nil )
40- if err != nil {
41- panic (err )
42- }
38+ require .NoError (t , err )
4339
4440 require .Equal (t , "[]github.com/99designs/gqlgen/codegen/config/testdata/autobinding/chat.Message" , ta .GO .String ())
4541 })
@@ -50,19 +46,13 @@ func TestOmittableBinding(t *testing.T) {
5046 binder , schema := createBinder (Config {})
5147
5248 ot , err := binder .FindType ("github.com/99designs/gqlgen/graphql" , "Omittable" )
53- if err != nil {
54- panic (err )
55- }
49+ require .NoError (t , err )
5650
5751 it , err := binder .InstantiateType (ot , []types.Type {types .Universe .Lookup ("string" ).Type ()})
58- if err != nil {
59- panic (err )
60- }
52+ require .NoError (t , err )
6153
6254 ta , err := binder .TypeReference (schema .Types ["FooInput" ].Fields .ForName ("nullableString" ).Type , it )
63- if err != nil {
64- panic (err )
65- }
55+ require .NoError (t , err )
6656
6757 require .True (t , ta .IsOmittable )
6858 })
@@ -71,19 +61,13 @@ func TestOmittableBinding(t *testing.T) {
7161 binder , schema := createBinder (Config {})
7262
7363 ot , err := binder .FindType ("github.com/99designs/gqlgen/graphql" , "Omittable" )
74- if err != nil {
75- panic (err )
76- }
64+ require .NoError (t , err )
7765
7866 it , err := binder .InstantiateType (ot , []types.Type {types .NewPointer (types .Universe .Lookup ("string" ).Type ())})
79- if err != nil {
80- panic (err )
81- }
67+ require .NoError (t , err )
8268
8369 ta , err := binder .TypeReference (schema .Types ["FooInput" ].Fields .ForName ("nullableString" ).Type , it )
84- if err != nil {
85- panic (err )
86- }
70+ require .NoError (t , err )
8771
8872 require .True (t , ta .IsOmittable )
8973 })
@@ -92,14 +76,10 @@ func TestOmittableBinding(t *testing.T) {
9276 binder , schema := createBinder (Config {})
9377
9478 ot , err := binder .FindType ("github.com/99designs/gqlgen/graphql" , "Omittable" )
95- if err != nil {
96- panic (err )
97- }
79+ require .NoError (t , err )
9880
9981 it , err := binder .InstantiateType (ot , []types.Type {types .Universe .Lookup ("string" ).Type ()})
100- if err != nil {
101- panic (err )
102- }
82+ require .NoError (t , err )
10383
10484 _ , err = binder .TypeReference (schema .Types ["FooInput" ].Fields .ForName ("nonNullableString" ).Type , it )
10585 require .Error (t , err )
@@ -109,14 +89,10 @@ func TestOmittableBinding(t *testing.T) {
10989 binder , schema := createBinder (Config {})
11090
11191 ot , err := binder .FindType ("github.com/99designs/gqlgen/graphql" , "Omittable" )
112- if err != nil {
113- panic (err )
114- }
92+ require .NoError (t , err )
11593
11694 it , err := binder .InstantiateType (ot , []types.Type {types .NewPointer (types .Universe .Lookup ("string" ).Type ())})
117- if err != nil {
118- panic (err )
119- }
95+ require .NoError (t , err )
12096
12197 _ , err = binder .TypeReference (schema .Types ["FooInput" ].Fields .ForName ("nonNullableString" ).Type , it )
12298 require .Error (t , err )
@@ -126,24 +102,16 @@ func TestOmittableBinding(t *testing.T) {
126102 binder , schema := createBinder (Config {})
127103
128104 typ , err := binder .FindType ("github.com/99designs/gqlgen/codegen/config/testdata/autobinding/chat" , "Message" )
129- if err != nil {
130- panic (err )
131- }
105+ require .NoError (t , err )
132106
133107 ot , err := binder .FindType ("github.com/99designs/gqlgen/graphql" , "Omittable" )
134- if err != nil {
135- panic (err )
136- }
108+ require .NoError (t , err )
137109
138110 it , err := binder .InstantiateType (ot , []types.Type {typ })
139- if err != nil {
140- panic (err )
141- }
111+ require .NoError (t , err )
142112
143113 ta , err := binder .TypeReference (schema .Types ["FooInput" ].Fields .ForName ("nullableObject" ).Type , it )
144- if err != nil {
145- panic (err )
146- }
114+ require .NoError (t , err )
147115
148116 require .True (t , ta .IsOmittable )
149117 })
@@ -152,24 +120,16 @@ func TestOmittableBinding(t *testing.T) {
152120 binder , schema := createBinder (Config {})
153121
154122 typ , err := binder .FindType ("github.com/99designs/gqlgen/codegen/config/testdata/autobinding/chat" , "Message" )
155- if err != nil {
156- panic (err )
157- }
123+ require .NoError (t , err )
158124
159125 ot , err := binder .FindType ("github.com/99designs/gqlgen/graphql" , "Omittable" )
160- if err != nil {
161- panic (err )
162- }
126+ require .NoError (t , err )
163127
164128 it , err := binder .InstantiateType (ot , []types.Type {types .NewPointer (typ )})
165- if err != nil {
166- panic (err )
167- }
129+ require .NoError (t , err )
168130
169131 ta , err := binder .TypeReference (schema .Types ["FooInput" ].Fields .ForName ("nullableObject" ).Type , it )
170- if err != nil {
171- panic (err )
172- }
132+ require .NoError (t , err )
173133
174134 require .True (t , ta .IsOmittable )
175135 })
0 commit comments