mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-25 16:08:46 +09:00
chore: introduce HTMLBuilder (#37688)
This commit is contained in:
@@ -22,3 +22,10 @@ func TestHTMLFormat(t *testing.T) {
|
||||
assert.Equal(t, template.HTML("<>"), HTMLFormat("%s", template.URL("<>")))
|
||||
assert.Equal(t, template.HTML("&StringMethod &StringMethod"), HTMLFormat("%s %s", testStringer{}, &testStringer{}))
|
||||
}
|
||||
|
||||
func TestHTMLBuilder(t *testing.T) {
|
||||
b := &HTMLBuilder{}
|
||||
b.WriteString("<").WriteHTML("<hr>").WriteFormat("<span>%s%s</span>", ">", EscapeString(">"))
|
||||
assert.Equal(t, "<<hr><span>>></span>", b.String())
|
||||
assert.Equal(t, template.HTML("<<hr><span>>></span>"), b.HTMLString())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user