Skip to content

Commit 1565a77

Browse files
committed
Add String methods and their tests for all new types
1 parent 4dcd653 commit 1565a77

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

github/pulls_reviews.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,41 @@ type PullRequestReviewComment struct {
4040
PullRequestURL *string `json:"pull_request_url,omitempty"`
4141
}
4242

43+
func (c PullRequestReviewComment) String() string {
44+
return Stringify(c)
45+
}
46+
4347
// DraftReviewComment represents a comment part of the review.
4448
type DraftReviewComment struct {
4549
Path *string `json:"path,omitempty"`
4650
Position *int `json:"position,omitempty"`
4751
Body *string `json:"body,omitempty"`
4852
}
4953

54+
func (c DraftReviewComment) String() string {
55+
return Stringify(c)
56+
}
57+
5058
// PullRequestReviewRequest represents a request to create a review.
5159
type PullRequestReviewRequest struct {
5260
Body *string `json:"body,omitempty"`
5361
Event *string `json:"event,omitempty"`
5462
Comments []DraftReviewComment `json:"comments,omitempty"`
5563
}
5664

65+
func (r PullRequestReviewRequest) String() string {
66+
return Stringify(r)
67+
}
68+
5769
// PullRequestReviewDismissalRequest represents a request to dismiss a review.
5870
type PullRequestReviewDismissalRequest struct {
5971
Message *string `json:"message,omitempty"`
6072
}
6173

74+
func (r PullRequestReviewDismissalRequest) String() string {
75+
return Stringify(r)
76+
}
77+
6278
// ListReviews lists all reviews on the specified pull request.
6379
//
6480
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request

github/strings_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ func TestString(t *testing.T) {
109109
{Organization{ID: Int(1)}, `github.Organization{ID:1}`},
110110
{PullRequestComment{ID: Int(1)}, `github.PullRequestComment{ID:1}`},
111111
{PullRequest{Number: Int(1)}, `github.PullRequest{Number:1}`},
112+
{PullRequestReview{ID: Int(1)}, `github.PullRequestReview{ID:1}`},
113+
{PullRequestReviewComment{ID: Int(1)}, `github.PullRequestReviewComment{ID:1}`},
114+
{DraftReviewComment{Position: Int(1)}, `github.DraftReviewComment{Position:1}`},
115+
{PullRequestReviewRequest{Body: String("r")}, `github.PullRequestReviewRequest{Body:"r"}`},
116+
{PullRequestReviewDismissalRequest{Message: String("r")}, `github.PullRequestReviewDismissalRequest{Message:"r"}`},
112117
{PushEventCommit{SHA: String("s")}, `github.PushEventCommit{SHA:"s"}`},
113118
{PushEvent{PushID: Int(1)}, `github.PushEvent{PushID:1}`},
114119
{Reference{Ref: String("r")}, `github.Reference{Ref:"r"}`},

0 commit comments

Comments
 (0)