mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
tpl: Test with nil value in first, last, after and shuffle
This commit is contained in:
parent
3cc468a82f
commit
f90b45f7f3
1 changed files with 4 additions and 0 deletions
|
@ -266,6 +266,7 @@ func TestFirst(t *testing.T) {
|
||||||
{1, nil, false},
|
{1, nil, false},
|
||||||
{nil, []int{100}, false},
|
{nil, []int{100}, false},
|
||||||
{1, t, false},
|
{1, t, false},
|
||||||
|
{1, (*string)(nil), false},
|
||||||
} {
|
} {
|
||||||
results, err := first(this.count, this.sequence)
|
results, err := first(this.count, this.sequence)
|
||||||
if b, ok := this.expect.(bool); ok && !b {
|
if b, ok := this.expect.(bool); ok && !b {
|
||||||
|
@ -300,6 +301,7 @@ func TestLast(t *testing.T) {
|
||||||
{1, nil, false},
|
{1, nil, false},
|
||||||
{nil, []int{100}, false},
|
{nil, []int{100}, false},
|
||||||
{1, t, false},
|
{1, t, false},
|
||||||
|
{1, (*string)(nil), false},
|
||||||
} {
|
} {
|
||||||
results, err := last(this.count, this.sequence)
|
results, err := last(this.count, this.sequence)
|
||||||
if b, ok := this.expect.(bool); ok && !b {
|
if b, ok := this.expect.(bool); ok && !b {
|
||||||
|
@ -334,6 +336,7 @@ func TestAfter(t *testing.T) {
|
||||||
{1, nil, false},
|
{1, nil, false},
|
||||||
{nil, []int{100}, false},
|
{nil, []int{100}, false},
|
||||||
{1, t, false},
|
{1, t, false},
|
||||||
|
{1, (*string)(nil), false},
|
||||||
} {
|
} {
|
||||||
results, err := after(this.count, this.sequence)
|
results, err := after(this.count, this.sequence)
|
||||||
if b, ok := this.expect.(bool); ok && !b {
|
if b, ok := this.expect.(bool); ok && !b {
|
||||||
|
@ -367,6 +370,7 @@ func TestShuffleInputAndOutputFormat(t *testing.T) {
|
||||||
{[]int{100}, true},
|
{[]int{100}, true},
|
||||||
{nil, false},
|
{nil, false},
|
||||||
{t, false},
|
{t, false},
|
||||||
|
{(*string)(nil), false},
|
||||||
} {
|
} {
|
||||||
results, err := shuffle(this.sequence)
|
results, err := shuffle(this.sequence)
|
||||||
if !this.success {
|
if !this.success {
|
||||||
|
|
Loading…
Reference in a new issue