From 6728d0bd9adf0ff389bb7c9aab34fa2e5b48c839 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Mon, 31 Oct 2022 12:53:31 +0530 Subject: [PATCH] add test case for json marshal - CodeSearchResult --- github/search_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/search_test.go b/github/search_test.go index bb62aa64d9..8998681eaa 100644 --- a/github/search_test.go +++ b/github/search_test.go @@ -989,3 +989,21 @@ func TestUsersSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestCodeSearchResult_Marshal(t *testing.T) { + testJSONMarshal(t, &CodeSearchResult{}, "{}") + + u := &CodeSearchResult{ + Total: Int(4), + IncompleteResults: Bool(false), + CodeResults: []*CodeResult{{Name: String("n")}}, + } + + want := `{ + "total_count" : 4, + "incomplete_results" : false, + "items" : [{"name": "n"}] + }` + + testJSONMarshal(t, u, want) +}