-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix regex for issues in commit messages Use same regex as markup for matching in commits. Fixes #7438 * make fmt
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,25 @@ func TestPushCommits_AvatarLink(t *testing.T) { | |
pushCommits.AvatarLink("[email protected]")) | ||
} | ||
|
||
func TestRegExp_issueReferenceKeywordsPat(t *testing.T) { | ||
trueTestCases := []string{ | ||
"#2", | ||
"[#2]", | ||
"please see go-gitea/gitea#5", | ||
} | ||
falseTestCases := []string{ | ||
"kb#2", | ||
"#2xy", | ||
} | ||
|
||
for _, testCase := range trueTestCases { | ||
assert.True(t, issueReferenceKeywordsPat.MatchString(testCase)) | ||
} | ||
for _, testCase := range falseTestCases { | ||
assert.False(t, issueReferenceKeywordsPat.MatchString(testCase)) | ||
} | ||
} | ||
|
||
func Test_getIssueFromRef(t *testing.T) { | ||
assert.NoError(t, PrepareTestDatabase()) | ||
repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) | ||
|