diff options
author | Nuno Silva <nuno-silva@users.noreply.github.com> | 2021-01-03 15:11:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-03 23:11:10 +0800 |
commit | 44ff1d6a1e20694b678ba53b0f1e03e9c7c5b8a6 (patch) | |
tree | 96e381eb5e798080509e2c588a83dfd17770dfb7 /modules/markup/html_test.go | |
parent | 7576e37a65729363370d6672ff6e69e87b68ac5f (diff) | |
download | gitea-44ff1d6a1e20694b678ba53b0f1e03e9c7c5b8a6.tar.gz gitea-44ff1d6a1e20694b678ba53b0f1e03e9c7c5b8a6.zip |
Render links for commit hashes followed by comma (#14224)
Regex test cases: https://regex101.com/r/mVbPxM/2/
fixes #14223
Diffstat (limited to 'modules/markup/html_test.go')
-rw-r--r-- | modules/markup/html_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index a3c273e628..b04781489a 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -46,6 +46,12 @@ func TestRender_Commits(t *testing.T) { test("/home/gitea/"+sha, "<p>/home/gitea/"+sha+"</p>") test("deadbeef", `<p>deadbeef</p>`) test("d27ace93", `<p>d27ace93</p>`) + test(sha[:14]+".x", `<p>`+sha[:14]+`.x</p>`) + + expected14 := `<a href="` + commit[:len(commit)-(40-14)] + `" rel="nofollow"><code>` + sha[:10] + `</code></a>` + test(sha[:14]+".", `<p>`+expected14+`.</p>`) + test(sha[:14]+",", `<p>`+expected14+`,</p>`) + test("["+sha[:14]+"]", `<p>[`+expected14+`]</p>`) } func TestRender_CrossReferences(t *testing.T) { |