summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-02-23 08:08:17 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-02-23 09:36:14 +0100
commit7d78a498e19c2331a325fa43dd46f4da2b0443a6 (patch)
tree93f993e6059d2f92df0b9bd2dd4870ff80eb742e /hugolib/shortcode_test.go
parent0dbeac80cdbf9a28d7b5640b404f040745787a53 (diff)
Throw an error when shortcode is expected to be closed
Fixes #10675
Diffstat (limited to 'hugolib/shortcode_test.go')
-rw-r--r--hugolib/shortcode_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go
index 564d632e4..cd17e7874 100644
--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -1241,3 +1241,38 @@ InnerDeindent: closing-no-newline: 0
`)
}
+
+// Issue 10675.
+func TestShortcodeErrorWhenItShouldBeClosed(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- config.toml --
+disableKinds = ["home", "taxonomy", "term"]
+-- content/p1.md --
+---
+title: "p1"
+---
+
+{{< sc >}}
+
+Text.
+
+-- layouts/shortcodes/sc.html --
+Inner: {{ .Get 0 }}: {{ len .Inner }}
+-- layouts/_default/single.html --
+{{ .Content }}
+`
+
+ b, err := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ Running: true,
+ Verbose: true,
+ },
+ ).BuildE()
+
+ b.Assert(err, qt.Not(qt.IsNil))
+ b.Assert(err.Error(), qt.Contains, `p1.md:5:1": failed to extract shortcode: unclosed shortcode "sc"`)
+}