shithub: hugo

Download patch

ref: f90b45f7f33a78a6c6248d628190b0e049667704
parent: 3cc468a82f91714f2da1c62d2e6b54f82e5a7890
author: Bjørn Erik Pedersen <[email protected]>
date: Sun Feb 7 16:16:43 EST 2016

tpl: Test with nil value in first, last, after and shuffle

--- a/tpl/template_funcs_test.go
+++ b/tpl/template_funcs_test.go
@@ -266,6 +266,7 @@
 		{1, nil, false},
 		{nil, []int{100}, false},
 		{1, t, false},
+		{1, (*string)(nil), false},
 	} {
 		results, err := first(this.count, this.sequence)
 		if b, ok := this.expect.(bool); ok && !b {
@@ -300,6 +301,7 @@
 		{1, nil, false},
 		{nil, []int{100}, false},
 		{1, t, false},
+		{1, (*string)(nil), false},
 	} {
 		results, err := last(this.count, this.sequence)
 		if b, ok := this.expect.(bool); ok && !b {
@@ -334,6 +336,7 @@
 		{1, nil, false},
 		{nil, []int{100}, false},
 		{1, t, false},
+		{1, (*string)(nil), false},
 	} {
 		results, err := after(this.count, this.sequence)
 		if b, ok := this.expect.(bool); ok && !b {
@@ -367,6 +370,7 @@
 		{[]int{100}, true},
 		{nil, false},
 		{t, false},
+		{(*string)(nil), false},
 	} {
 		results, err := shuffle(this.sequence)
 		if !this.success {