Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: go/util/util_test.go

Issue 1849283002: AutoRolls include Chromium bug links (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: ... Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« go/util/util.go ('K') | « go/util/util.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/util/util_test.go
diff --git a/go/util/util_test.go b/go/util/util_test.go
index ee9c6c933bc448313b93b96160155cd776ef3dfe..01f223fcff98fda507ae5b71ce32b614fd2385d1 100644
--- a/go/util/util_test.go
+++ b/go/util/util_test.go
@@ -305,3 +305,58 @@ func TestMD5Hash(t *testing.T) {
assert.NotEqual(t, h_1, h_3)
assert.Equal(t, h_2, h_3)
}
+
+func TestBugsFromCommitMsg(t *testing.T) {
+ cases := []struct {
+ in string
+ out map[string][]string
+ }{
+ {
+ in: "BUG=skia:1234",
+ out: map[string][]string{
+ "skia": []string{"1234"},
+ },
+ },
+ {
+ in: "BUG=skia:1234,skia:4567",
+ out: map[string][]string{
+ "skia": []string{"1234", "4567"},
+ },
+ },
+ {
+ in: "BUG=skia:1234,skia:4567,skia:8901",
+ out: map[string][]string{
+ "skia": []string{"1234", "4567", "8901"},
+ },
+ },
+ {
+ in: "BUG=1234",
+ out: map[string][]string{
+ "chromium": []string{"1234"},
+ },
+ },
+ {
+ in: "BUG=skia:1234, 456",
+ out: map[string][]string{
+ "chromium": []string{"456"},
+ "skia": []string{"1234"},
+ },
+ },
+ {
+ in: `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+Quisque feugiat, mi et tristique dignissim, sapien risus tristique mi, non dignissim nibh erat ut ex.
+
+BUG=1234, skia:5678
+`,
+ out: map[string][]string{
+ "chromium": []string{"1234"},
+ "skia": []string{"5678"},
+ },
+ },
+ }
+ for _, tc := range cases {
+ result := BugsFromCommitMsg(tc.in)
+ assert.Equal(t, tc.out, result)
+ }
+}
« go/util/util.go ('K') | « go/util/util.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698