forked from TrueCloudLab/dco-go
30 lines
698 B
Go
30 lines
698 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCommitMessages(t *testing.T) {
|
|
allowed := []string{
|
|
"[#1] omg: Make a commit",
|
|
"[#666] Omit component",
|
|
`Revert "[#114] local: Fix payload type after recent refactoring"`,
|
|
`Reapply "[#114] local: Fix payload type after recent refactoring"`,
|
|
`Release v0.4.2`,
|
|
}
|
|
|
|
for i := range allowed {
|
|
assert.True(t, rxHeader.MatchString(allowed[i]), "message: '%s'", allowed[i])
|
|
}
|
|
|
|
restricted := []string{
|
|
"[#xx] omg: Forget numbers",
|
|
"#12 Forget brackets",
|
|
"Refactor something",
|
|
}
|
|
for i := range restricted {
|
|
assert.False(t, rxHeader.MatchString(restricted[i]), "message: '%s'", restricted[i])
|
|
}
|
|
}
|