Fix bug in isHtmlTag()

Fix what seems to be a typo. j should iterate through all tagname, so it
should be initialized to zero. The test exposes this bug.
This commit is contained in:
Vytautas Šaltenis 2013-04-13 22:21:47 +03:00
parent 90509d39d4
commit d5a8df164b
2 changed files with 9 additions and 1 deletions

View File

@ -663,7 +663,7 @@ func isHtmlTag(tag []byte, tagname string) bool {
i++ i++
} }
j := i j := 0
for ; i < len(tag); i, j = i+1, j+1 { for ; i < len(tag); i, j = i+1, j+1 {
if j >= len(tagname) { if j >= len(tagname) {
break break

View File

@ -63,6 +63,14 @@ func doTestsInlineParam(t *testing.T, tests []string, extensions, htmlFlags int)
} }
} }
func TestRawHtmlTag(t *testing.T) {
tests := []string{
"zz <style>p {}</style>\n",
"<p>zz p {}</p>\n",
}
doTestsInlineParam(t, tests, 0, HTML_SKIP_STYLE)
}
func TestEmphasis(t *testing.T) { func TestEmphasis(t *testing.T) {
var tests = []string{ var tests = []string{
"nothing inline\n", "nothing inline\n",