mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Improve type handling in Seq
This commit is contained in:
parent
b3bd71fec9
commit
e39a258ec4
2 changed files with 5 additions and 1 deletions
|
@ -175,6 +175,10 @@ func Seq(args ...interface{}) ([]int, error) {
|
|||
|
||||
intArgs := cast.ToIntSlice(args)
|
||||
|
||||
if len(intArgs) < 1 || len(intArgs) > 3 {
|
||||
return nil, errors.New("Invalid argument(s) to Seq")
|
||||
}
|
||||
|
||||
var inc int = 1
|
||||
var last int
|
||||
var first = intArgs[0]
|
||||
|
|
|
@ -154,7 +154,7 @@ func TestSeq(t *testing.T) {
|
|||
{[]interface{}{2, 1, 1, 1}, false},
|
||||
{[]interface{}{2001}, false},
|
||||
{[]interface{}{}, false},
|
||||
{[]interface{}{t}, []int{}},
|
||||
{[]interface{}{t}, false},
|
||||
{nil, false},
|
||||
} {
|
||||
|
||||
|
|
Loading…
Reference in a new issue