summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-21 15:30:12 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-21 15:30:43 +0200
commit0bdc0d62d4f5d117032e4c09f2438e9df4a9c18b (patch)
tree0e8b95983110d5405b38e5506caa013cba58fefb /hugolib/shortcode_test.go
parent198efc89ca537a859f93cd775ea221d5032f1ac8 (diff)
Add shortcode null param variant
See #2294
Diffstat (limited to 'hugolib/shortcode_test.go')
-rw-r--r--hugolib/shortcode_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go
index 55a8a22fe..b30b5b511 100644
--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -124,6 +124,13 @@ func TestPositionalParamIndexOutOfBounds(t *testing.T) {
CheckShortCodeMatch(t, "{{< video 47238zzb >}}", "Playing Video error: index out of range for positional param at position 1", tem)
}
+// Issue #2294
+func TestPositionalParamNil(t *testing.T) {
+ tem := tpl.New()
+ tem.AddInternalShortcode("div.html", `<div data='{{ .Get 0 }}'>{{ .Inner }}</div>`)
+ CheckShortCodeMatch(t, "{{% div %}}**foo**{{% /div %}}", "<div data=''><strong>foo</strong></div>", tem)
+}
+
// some repro issues for panics in Go Fuzz testing
func TestShortcodeGoFuzzRepros(t *testing.T) {
tt := tpl.New()