1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

tpl: check slice bounds in slicestr

Fixes #1090
This commit is contained in:
bep
2015-04-30 11:26:34 +02:00
parent be3b8a132b
commit be017f187e
3 changed files with 17 additions and 1 deletions

View File

@@ -291,6 +291,11 @@ func TestSlicestr(t *testing.T) {
{"abcdef", []int{2}, "cdef"},
{123, []int{1, 3}, "23"},
{123, []int{1, 2, 3}, false},
{"abcdef", []int{6}, false},
{"abcdef", []int{4, 7}, false},
{"abcdef", []int{-1}, false},
{"abcdef", []int{-1, 7}, false},
{"abcdef", []int{1, -1}, false},
{tstNoStringer{}, []int{0, 1}, false},
} {
result, err := Slicestr(this.v1, this.v2...)