Skip to content

Commit

Permalink
hugolib: Adjust tests for shortcode p-issue
Browse files Browse the repository at this point in the history
See #1642
  • Loading branch information
bep committed Aug 17, 2018
1 parent 78c9946 commit baa62d0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion hugolib/shortcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ And then:
This is **plain** text.
{{< /inside >}}
`, "<div><h1 id=\"more-here\">More Here</h1>\n\n<p><a href=\"http://spf13.com\">link</a> and text</p>\n</div>\n\n<p>And then:</p>\n\n<p><div>\n# More Here\n\nThis is **plain** text.\n\n</div>", wt)
`, "<div><h1 id=\"more-here\">More Here</h1>\n\n<p><a href=\"http://spf13.com\">link</a> and text</p>\n</div>\n\n<p>And then:</p>\n\n<div>\n# More Here\n\nThis is **plain** text.\n\n</div>", wt)
}

func TestEmbeddedSC(t *testing.T) {
Expand Down Expand Up @@ -335,6 +335,20 @@ func TestFigureLinkWithTargetAndRel(t *testing.T) {
CheckShortCodeMatch(t, `{{< figure src="/found/here" link="/jump/here/on/clicking" target="_blank" rel="noopener" >}}`, "\n<figure>\n <a href=\"/jump/here/on/clicking\" target=\"_blank\" rel=\"noopener\">\n <img src=\"/found/here\" />\n </a>\n \n</figure>\n", nil)
}

// #1642
func TestShortcodeWrappedInPIssue(t *testing.T) {
t.Parallel()
wt := func(tem tpl.TemplateHandler) error {
tem.AddTemplate("_internal/shortcodes/bug.html", `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`)
return nil
}
CheckShortCodeMatch(t, `
{{< bug >}}
{{< bug >}}
`, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", wt)
}

const testScPlaceholderRegexp = "HAHAHUGOSHORTCODE-\\d+HBHB"

func TestExtractShortcodes(t *testing.T) {
Expand Down

0 comments on commit baa62d0

Please sign in to comment.