forked from forgejo/forgejo
Render links for commit hashes followed by comma (#14224)
Regex test cases: https://regex101.com/r/mVbPxM/2/ fixes #14223
This commit is contained in:
parent
7576e37a65
commit
44ff1d6a1e
2 changed files with 7 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue