Skip to content

Commit db19a31

Browse files
committed
add more tests
1 parent e1b06b5 commit db19a31

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

modules/markup/html_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ func TestRender_links(t *testing.T) {
204204
test(
205205
"magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&dn=download",
206206
`<p><a href="magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&amp;dn=download" rel="nofollow">magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&amp;dn=download</a></p>`)
207+
test(
208+
`[link](https://example.com)`,
209+
`<p><a href="https://example.com" rel="nofollow">link</a></p>`)
210+
test(
211+
`[link](mailto:test@example.com)`,
212+
`<p><a href="mailto:test@example.com" rel="nofollow">link</a></p>`)
207213

208214
// Test that should *not* be turned into URL
209215
test(
@@ -673,3 +679,9 @@ func TestIssue18471(t *testing.T) {
673679
assert.NoError(t, err)
674680
assert.Equal(t, "<a href=\"http://domain/org/repo/compare/783b039...da951ce\" class=\"compare\"><code class=\"nohighlight\">783b039...da951ce</code></a>", res.String())
675681
}
682+
683+
func TestIsFullURL(t *testing.T) {
684+
assert.True(t, markup.IsFullURLString("https://example.com"))
685+
assert.True(t, markup.IsFullURLString("mailto:test@example.com"))
686+
assert.False(t, markup.IsFullURLString("/foo:bar"))
687+
}

0 commit comments

Comments
 (0)