diff options
Diffstat (limited to 'pkg/git/git_test.go')
| -rw-r--r-- | pkg/git/git_test.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pkg/git/git_test.go b/pkg/git/git_test.go index 3cc1300dd..8e23e84b2 100644 --- a/pkg/git/git_test.go +++ b/pkg/git/git_test.go @@ -4,6 +4,8 @@ package git import ( + "reflect" + "strings" "testing" ) @@ -72,3 +74,49 @@ func TestCheckBranch(t *testing.T) { } } } + +func TestExtractFixTags(t *testing.T) { + commits, err := extractFixTags(strings.NewReader(extractFixTagsInput), extractFixTagsEmail) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(commits, extractFixTagsOutput) { + t.Fatalf("got : %+v\twant: %+v", commits, extractFixTagsOutput) + } +} + +const extractFixTagsEmail = "\"syzbot\" <syzbot@my.mail.com>" + +var extractFixTagsOutput = []FixCommit{ + {"8e4090902540da8c6e8f", "dashboard/app: bump max repros per bug to 10"}, + {"8e4090902540da8c6e8f", "executor: remove dead code"}, + {"a640a0fc325c29c3efcb", "executor: remove dead code"}, + {"8e4090902540da8c6e8fa640a0fc325c29c3efcb", "pkg/csource: fix string escaping bug"}, +} + +var extractFixTagsInput = ` +commit 73aba437a774237b1130837b856f3b40b3ec3bf0 (HEAD -> master, origin/master) +Author: me <foo@bar.com> +Date: Fri Dec 22 19:59:56 2017 +0100 + + dashboard/app: bump max repros per bug to 10 + + Reported-by: syzbot+8e4090902540da8c6e8f@my.mail.com + +commit 26cd53f078db858a6ccca338e13e7f4d1d291c22 +Author: me <foo@bar.com> +Date: Fri Dec 22 13:42:27 2017 +0100 + + executor: remove dead code + + Reported-by: syzbot+8e4090902540da8c6e8f@my.mail.com + Reported-by: syzbot <syzbot+a640a0fc325c29c3efcb@my.mail.com> + +commit 7b62abdb0abadbaf7b3f3a23ab4d78485fbf9059 +Author: Dmitry Vyukov <dvyukov@google.com> +Date: Fri Dec 22 11:59:09 2017 +0100 + + pkg/csource: fix string escaping bug + + Reported-and-tested-by: syzbot+8e4090902540da8c6e8fa640a0fc325c29c3efcb@my.mail.com +` |
