未验证 提交 1e85063b 编写于 作者: P Phodal Huang

test: add test for change log

上级 59194f73
......@@ -38,11 +38,10 @@ func BuildChangeMap(commits []CommitMessage) map[string]map[string]int {
for _, commit := range commits {
message := commit.Message
if logRegexp.MatchString(message) {
matchs := logRegexp.FindStringSubmatch(message)
if len(matchs) > 3 {
keyword := matchs[1]
//message := matchs[3]
matches := logRegexp.FindStringSubmatch(message)
if len(matches) > 3 {
keyword := matches[1]
//message := matches[3]
if _, ok := czMap[keyword];!ok {
czMap[keyword] = make(map[string]int)
......
package gitt
import (
. "github.com/onsi/gomega"
"testing"
)
func TestBuildChangeMap(t *testing.T) {
g := NewGomegaWithT(t)
result := BuildMessageByInput(`
[c24069b] Phodal HUANG 2019-10-25 fix: fix test
7 0 README.md
[c24069b] Phodal HUANG 2019-10-25 feat: add README.md
7 0 README.md
`)
buildChangeMap := BuildChangeMap(result)
g.Expect(buildChangeMap["feat"]["README.md"]).To(Equal(1))
g.Expect(buildChangeMap["fix"]["README.md"]).To(Equal(1))
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册