diff options
Diffstat (limited to 'modules/markup/html_internal_test.go')
-rw-r--r-- | modules/markup/html_internal_test.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/modules/markup/html_internal_test.go b/modules/markup/html_internal_test.go index b8612eb2bb..cc261318eb 100644 --- a/modules/markup/html_internal_test.go +++ b/modules/markup/html_internal_test.go @@ -71,6 +71,7 @@ func TestRender_IssueIndexPattern(t *testing.T) { test("test#1234") test("#1234test") test(" test #1234test") + test("/home/gitea/#1234") // should not render issue mention without leading space test("test#54321 issue") @@ -103,9 +104,11 @@ func TestRender_IssueIndexPattern2(t *testing.T) { test("#1234 test", "%s test", 1234) test("test #8 issue", "test %s issue", 8) test("test issue #1234", "test issue %s", 1234) + test("fixes issue #1234.", "fixes issue %s.", 1234) - // should render mentions in parentheses + // should render mentions in parentheses / brackets test("(#54321 issue)", "(%s issue)", 54321) + test("[#54321 issue]", "[%s issue]", 54321) test("test (#9801 extra) issue", "test (%s extra) issue", 9801) test("test (#1)", "test (%s)", 1) @@ -253,10 +256,14 @@ func TestRegExp_sha1CurrentPattern(t *testing.T) { trueTestCases := []string{ "d8a994ef243349f321568f9e36d5c3f444b99cae", "abcdefabcdefabcdefabcdefabcdefabcdefabcd", + "(abcdefabcdefabcdefabcdefabcdefabcdefabcd)", + "[abcdefabcdefabcdefabcdefabcdefabcdefabcd]", + "abcdefabcdefabcdefabcdefabcdefabcdefabcd.", } falseTestCases := []string{ "test", "abcdefg", + "e59ff077-2d03-4e6b-964d-63fbaea81f", "abcdefghijklmnopqrstuvwxyzabcdefghijklmn", "abcdefghijklmnopqrstuvwxyzabcdefghijklmO", } @@ -309,7 +316,9 @@ func TestRegExp_mentionPattern(t *testing.T) { "@ANT_123", "@xxx-DiN0-z-A..uru..s-xxx", " @lol ", - " @Te/st", + " @Te-st", + "(@gitea)", + "[@gitea]", } falseTestCases := []string{ "@ 0", @@ -317,6 +326,8 @@ func TestRegExp_mentionPattern(t *testing.T) { "@", "", "ABC", + "/home/gitea/@gitea", + "\"@gitea\"", } for _, testCase := range trueTestCases { @@ -335,6 +346,9 @@ func TestRegExp_issueAlphanumericPattern(t *testing.T) { "A-1", "RC-80", "ABCDEFGHIJ-1234567890987654321234567890", + "ABC-123.", + "(ABC-123)", + "[ABC-123]", } falseTestCases := []string{ "RC-08", @@ -347,6 +361,8 @@ func TestRegExp_issueAlphanumericPattern(t *testing.T) { "ABC", "GG-", "rm-1", + "/home/gitea/ABC-1234", + "MY-STRING-ABC-123", } for _, testCase := range trueTestCases { |