summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-10-22 20:20:48 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-10-23 08:09:41 +0200
commited7b3e261909fe425ef64216f12806840c45b205 (patch)
treec082a1f0b2f0ac4cbb95faa1779fdbaa2845b5a7 /hugolib/shortcode_test.go
parent2bf686ee217808186385bfcf6156f15bbdb33651 (diff)
commands, hugolib: Get file context in "config parse failed" errors
Fixes #5325
Diffstat (limited to 'hugolib/shortcode_test.go')
-rw-r--r--hugolib/shortcode_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go
index 6e250ed21..0d397f9ee 100644
--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -368,11 +368,11 @@ func TestExtractShortcodes(t *testing.T) {
expectErrorMsg string
}{
{"text", "Some text.", "map[]", "Some text.", ""},
- {"invalid right delim", "{{< tag }}", "", false, ":5:.*unrecognized character.*}"},
- {"invalid close", "\n{{< /tag >}}", "", false, ":6:.*got closing shortcode, but none is open"},
- {"invalid close2", "\n\n{{< tag >}}{{< /anotherTag >}}", "", false, ":7: closing tag for shortcode 'anotherTag' does not match start tag"},
- {"unterminated quote 1", `{{< figure src="im caption="S" >}}`, "", false, ":5:.got pos.*"},
- {"unterminated quote 1", `{{< figure src="im" caption="S >}}`, "", false, ":5:.*unterm.*}"},
+ {"invalid right delim", "{{< tag }}", "", false, "unrecognized character"},
+ {"invalid close", "\n{{< /tag >}}", "", false, "got closing shortcode, but none is open"},
+ {"invalid close2", "\n\n{{< tag >}}{{< /anotherTag >}}", "", false, "closing tag for shortcode 'anotherTag' does not match start tag"},
+ {"unterminated quote 1", `{{< figure src="im caption="S" >}}`, "", false, "got pos"},
+ {"unterminated quote 1", `{{< figure src="im" caption="S >}}`, "", false, "unterm"},
{"one shortcode, no markup", "{{< tag >}}", "", testScPlaceholderRegexp, ""},
{"one shortcode, markup", "{{% tag %}}", "", testScPlaceholderRegexp, ""},
{"one pos param", "{{% tag param1 %}}", `tag([\"param1\"], true){[]}"]`, testScPlaceholderRegexp, ""},
@@ -430,7 +430,7 @@ func TestExtractShortcodes(t *testing.T) {
if err == nil {
t.Fatalf("[%d] %s: ExtractShortcodes didn't return an expected error", i, this.name)
} else {
- r, _ := regexp.Compile(this.expectErrorMsg)
+ r := regexp.MustCompile(this.expectErrorMsg)
if !r.MatchString(err.Error()) {
t.Fatalf("[%d] %s: ExtractShortcodes didn't return an expected error message, got\n%s but expected\n%s",
i, this.name, err.Error(), this.expectErrorMsg)