diff options
author | Baibhav Vatsa <baibhavvatsa@gmail.com> | 2019-10-10 20:16:15 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-10-11 08:35:27 +0200 |
commit | 096a4b67b98259dabff5ebfbfd879a41999a1ed2 (patch) | |
tree | d940a0429e0983bd5c462b8841ca292b87886c2a /tpl/collections/collections_test.go | |
parent | bc70f2bf123d94fc3226754ec9f1f44748e98162 (diff) |
tpl: After now accepts 0 as index
Modified the if conditional because of which after threw an error if called with 0 as index. The function now returns the whole original slice if 0 is passed as an index. Also added tests to test the new behavior.
Fixes #6388
Diffstat (limited to 'tpl/collections/collections_test.go')
-rw-r--r-- | tpl/collections/collections_test.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go index 8ea973f0b..781f44e0a 100644 --- a/tpl/collections/collections_test.go +++ b/tpl/collections/collections_test.go @@ -50,6 +50,8 @@ func TestAfter(t *testing.T) { {int64(2), []int{100, 200, 300}, []int{300}}, {100, []int{100, 200}, []int{}}, {"1", []int{100, 200, 300}, []int{200, 300}}, + {0, []int{100, 200, 300, 400, 500}, []int{100, 200, 300, 400, 500}}, + {0, []string{"a", "b", "c", "d", "e"}, []string{"a", "b", "c", "d", "e"}}, {int64(-1), []int{100, 200, 300}, false}, {"noint", []int{100, 200, 300}, false}, {2, []string{}, []string{}}, |