Skip to content

Commit 653f420

Browse files
authored
Improve gitignore.go coverage (google#1724)
1 parent 63d85ab commit 653f420

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

github/gitignore_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ func TestGitignoresService_List(t *testing.T) {
3232
if !reflect.DeepEqual(available, want) {
3333
t.Errorf("Gitignores.List returned %+v, want %+v", available, want)
3434
}
35+
36+
const methodName = "List"
37+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
38+
got, resp, err := client.Gitignores.List(ctx)
39+
if got != nil {
40+
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
41+
}
42+
return resp, err
43+
})
3544
}
3645

3746
func TestGitignoresService_Get(t *testing.T) {
@@ -53,6 +62,20 @@ func TestGitignoresService_Get(t *testing.T) {
5362
if !reflect.DeepEqual(gitignore, want) {
5463
t.Errorf("Gitignores.Get returned %+v, want %+v", gitignore, want)
5564
}
65+
66+
const methodName = "Get"
67+
testBadOptions(t, methodName, func() (err error) {
68+
_, _, err = client.Gitignores.Get(ctx, "\n")
69+
return err
70+
})
71+
72+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
73+
got, resp, err := client.Gitignores.Get(ctx, "name")
74+
if got != nil {
75+
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
76+
}
77+
return resp, err
78+
})
5679
}
5780

5881
func TestGitignoresService_Get_invalidTemplate(t *testing.T) {

0 commit comments

Comments
 (0)