mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 22:50:35 +03:00
shortcodeparser: fix panic on slash following opening shortcode comment
Fixes #1093
This commit is contained in:
parent
be7b830f33
commit
be9df84772
4 changed files with 38 additions and 5 deletions
|
@ -31,6 +31,35 @@ func CheckShortCodeMatch(t *testing.T, input, expected string, template tpl.Temp
|
|||
}
|
||||
}
|
||||
|
||||
func TestShortcodeGoFuzzReports(t *testing.T) {
|
||||
tem := tpl.New()
|
||||
|
||||
tem.AddInternalShortcode("sc.html", `foo`)
|
||||
p, _ := pageFromString(SIMPLE_PAGE, "simple.md")
|
||||
|
||||
for i, this := range []struct {
|
||||
data string
|
||||
expectErr bool
|
||||
}{
|
||||
{"{{</*/", true},
|
||||
} {
|
||||
output, err := HandleShortcodes(this.data, p, tem)
|
||||
|
||||
if this.expectErr && err == nil {
|
||||
t.Errorf("[%d] should have errored", i)
|
||||
}
|
||||
|
||||
if !this.expectErr && err != nil {
|
||||
t.Errorf("[%d] should not have errored: %s", i, err)
|
||||
}
|
||||
|
||||
if !this.expectErr && err == nil && len(output) == 0 {
|
||||
t.Errorf("[%d] empty result", i)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestNonSC(t *testing.T) {
|
||||
tem := tpl.New()
|
||||
// notice the syntax diff from 0.12, now comment delims must be added
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue