@@ -91,6 +91,20 @@ func TestGistsService_ListComments(t *testing.T) {
91
91
if ! reflect .DeepEqual (comments , want ) {
92
92
t .Errorf ("Gists.ListComments returned %+v, want %+v" , comments , want )
93
93
}
94
+
95
+ const methodName = "ListComments"
96
+ testBadOptions (t , methodName , func () (err error ) {
97
+ _ , _ , err = client .Gists .ListComments (ctx , "\n " , opt )
98
+ return err
99
+ })
100
+
101
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
102
+ got , resp , err := client .Gists .ListComments (ctx , "1" , opt )
103
+ if got != nil {
104
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
105
+ }
106
+ return resp , err
107
+ })
94
108
}
95
109
96
110
func TestGistsService_ListComments_invalidID (t * testing.T ) {
@@ -121,6 +135,20 @@ func TestGistsService_GetComment(t *testing.T) {
121
135
if ! reflect .DeepEqual (comment , want ) {
122
136
t .Errorf ("Gists.GetComment returned %+v, want %+v" , comment , want )
123
137
}
138
+
139
+ const methodName = "GetComment"
140
+ testBadOptions (t , methodName , func () (err error ) {
141
+ _ , _ , err = client .Gists .GetComment (ctx , "\n " , - 2 )
142
+ return err
143
+ })
144
+
145
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
146
+ got , resp , err := client .Gists .GetComment (ctx , "1" , 2 )
147
+ if got != nil {
148
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
149
+ }
150
+ return resp , err
151
+ })
124
152
}
125
153
126
154
func TestGistsService_GetComment_invalidID (t * testing.T ) {
@@ -160,6 +188,20 @@ func TestGistsService_CreateComment(t *testing.T) {
160
188
if ! reflect .DeepEqual (comment , want ) {
161
189
t .Errorf ("Gists.CreateComment returned %+v, want %+v" , comment , want )
162
190
}
191
+
192
+ const methodName = "CreateComment"
193
+ testBadOptions (t , methodName , func () (err error ) {
194
+ _ , _ , err = client .Gists .CreateComment (ctx , "\n " , input )
195
+ return err
196
+ })
197
+
198
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
199
+ got , resp , err := client .Gists .CreateComment (ctx , "1" , input )
200
+ if got != nil {
201
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
202
+ }
203
+ return resp , err
204
+ })
163
205
}
164
206
165
207
func TestGistsService_CreateComment_invalidID (t * testing.T ) {
@@ -199,6 +241,20 @@ func TestGistsService_EditComment(t *testing.T) {
199
241
if ! reflect .DeepEqual (comment , want ) {
200
242
t .Errorf ("Gists.EditComment returned %+v, want %+v" , comment , want )
201
243
}
244
+
245
+ const methodName = "EditComment"
246
+ testBadOptions (t , methodName , func () (err error ) {
247
+ _ , _ , err = client .Gists .EditComment (ctx , "\n " , - 2 , input )
248
+ return err
249
+ })
250
+
251
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
252
+ got , resp , err := client .Gists .EditComment (ctx , "1" , 2 , input )
253
+ if got != nil {
254
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
255
+ }
256
+ return resp , err
257
+ })
202
258
}
203
259
204
260
func TestGistsService_EditComment_invalidID (t * testing.T ) {
@@ -223,6 +279,16 @@ func TestGistsService_DeleteComment(t *testing.T) {
223
279
if err != nil {
224
280
t .Errorf ("Gists.Delete returned error: %v" , err )
225
281
}
282
+
283
+ const methodName = "DeleteComment"
284
+ testBadOptions (t , methodName , func () (err error ) {
285
+ _ , err = client .Gists .DeleteComment (ctx , "\n " , - 2 )
286
+ return err
287
+ })
288
+
289
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
290
+ return client .Gists .DeleteComment (ctx , "1" , 2 )
291
+ })
226
292
}
227
293
228
294
func TestGistsService_DeleteComment_invalidID (t * testing.T ) {
0 commit comments