@@ -100,5 +100,54 @@ func TestParsePSMessage(t *testing.T) {
if got, want := body, tc.wantBody; got != want {
t.Errorf("%d: got body: %q, want: %q", i, got, want)
}
}
}
func TestCommitMessageBody(t *testing.T) {
for i, tc := range []struct {
in string
want string
}{
{
in: `cmd/gopherbot: assign reviewers based on commit message prefixes
Previously, we assigned reviewers based on the file paths involved.
In practice, many changes focused in one directory have trivial
repercussions elsewhere, so that heuristic tends to involve too many
reviewers.
I added a path expansion function in CL 170863, so let's use that here
too: a human selected the paths for the commit message, so use that
human's choice to guide reviewer selection.
Fixes golang/go#30695
Change-Id: If28d6cb2511f4e3f3c651bf736dda394e098c17d
`,
want: `Previously, we assigned reviewers based on the file paths involved.
In practice, many changes focused in one directory have trivial
repercussions elsewhere, so that heuristic tends to involve too many
reviewers.
I added a path expansion function in CL 170863, so let's use that here
too: a human selected the paths for the commit message, so use that
human's choice to guide reviewer selection.
Fixes golang/go#30695`,
},
{
in: `transform, unicode/cldr: spell "Deprecated: Use etc" consistently
Change-Id: I5194e58a7679e33555856a413f6081fea26d8e34
`,
want: "",
},
} {
got := commitMessageBody(tc.in)
if got != tc.want {
t.Errorf("%d: got: %q, want: %q", i, got, tc.want)
}
}
}