package web
import "testing"
func TestCommentHTML(t *testing.T) {
for in, want := range map[string]string{
"fix [0123abcdef] regression": `fix <a href="/r/tk/info/0123abcdef">0123abcdef</a> regression`,
"see [0123abcdef|the fix]": `see <a href="/r/tk/info/0123abcdef">the fix</a>`,
"per [https://x.test/a|docs]": `per <a href="https://x.test/a">docs</a>`,
"read [Release Notes]": `read [Release Notes]`,
"a <b> & [c|<d>]": `a <b> & [c|<d>]`,
"case[0] in code": `case[0] in code`,
"empty [] brackets": `empty [] brackets`,
} {
if got := string(commentHTML("tk", in)); got != want {
t.Errorf("commentHTML(%q)\n got %s\n want %s", in, got, want)
}
}
}