Compare commits
1 commit
main
...
trstringer
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dd24779eb |
2 changed files with 21 additions and 1 deletions
|
|
@ -126,7 +126,7 @@ func approversIndex(approvers []string, name string) int {
|
|||
|
||||
func isApproved(commentBody string) (bool, error) {
|
||||
for _, approvedWord := range approvedWords {
|
||||
matched, err := regexp.MatchString(fmt.Sprintf("(?i)^%s[.!]?$", approvedWord), commentBody)
|
||||
matched, err := regexp.MatchString(fmt.Sprintf("(?i)^%s[.!]*\n*$", approvedWord), commentBody)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,6 +215,11 @@ func TestApprovedCommentBody(t *testing.T) {
|
|||
commentBody: "Approved!",
|
||||
isSuccess: true,
|
||||
},
|
||||
{
|
||||
name: "approved_titlecase_multi_exclamation",
|
||||
commentBody: "Approved!!",
|
||||
isSuccess: true,
|
||||
},
|
||||
{
|
||||
name: "approved_titlecase_question",
|
||||
commentBody: "Approved?",
|
||||
|
|
@ -230,6 +235,21 @@ func TestApprovedCommentBody(t *testing.T) {
|
|||
commentBody: "this is just some random comment",
|
||||
isSuccess: false,
|
||||
},
|
||||
{
|
||||
name: "approved_with_newline",
|
||||
commentBody: "approved\n",
|
||||
isSuccess: true,
|
||||
},
|
||||
{
|
||||
name: "approved_with_exclamation_newline",
|
||||
commentBody: "approved!\n",
|
||||
isSuccess: true,
|
||||
},
|
||||
{
|
||||
name: "approved_with_multi_exclamation_multi_newline",
|
||||
commentBody: "approved!!!\n\n\n",
|
||||
isSuccess: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue