-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add test case for JSON resource marshaling #2543
New issue
Have 8000 a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
591fd22
dac06fa
3f4fe5a
785c8e2
2e918d6
957b0ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -914,3 +914,42 @@ func TestLabelsSearchResult_Marshal(t *testing.T) { | |
|
||
testJSONMarshal(t, u, want) | ||
} | ||
|
||
func TestCommitResult_Marshal(t *testing.T) { | ||
testJSONMarshal(t, &CommitResult{}, "{}") | ||
|
||
c := &CommitResult{ | ||
SHA: String("test"), | ||
HTMLURL: String("hurl"), | ||
CommentsURL: String("curl"), | ||
URL: String("url"), | ||
Repository: &Repository{ID: Int64(1)}, | ||
Score: Float64(123), | ||
Commit: &Commit{SHA: String("test")}, | ||
Author: &User{ID: Int64(1)}, | ||
Committer: &User{ID: Int64(1)}, | ||
Parents: []*Commit{}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for not supplying a single parent? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind, let's get this in before I go OOO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's just an omitempty so I want to try to ignore this. But Thanks @gmlewis for approving :) |
||
} | ||
|
||
want := `{ | ||
"sha": "test", | ||
"commit": { | ||
"sha": "test" | ||
}, | ||
"author": { | ||
"id": 1 | ||
}, | ||
"committer": { | ||
"id": 1 | ||
}, | ||
"html_url": "hurl", | ||
"url": "url", | ||
"comments_url": "curl", | ||
"repository": { | ||
"id": 1 | ||
}, | ||
"score": 123 | ||
}` | ||
|
||
testJSONMarshal(t, c, want) | ||
} |
Uh oh!
There was an error while loading. Please reload this page.