Improve type handling in Seq

This commit is contained in:
bep 2015-03-18 11:10:04 +01:00
parent b3bd71fec9
commit e39a258ec4
2 changed files with 5 additions and 1 deletions

View file

@ -175,6 +175,10 @@ func Seq(args ...interface{}) ([]int, error) {
intArgs := cast.ToIntSlice(args) 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 inc int = 1
var last int var last int
var first = intArgs[0] var first = intArgs[0]

View file

@ -154,7 +154,7 @@ func TestSeq(t *testing.T) {
{[]interface{}{2, 1, 1, 1}, false}, {[]interface{}{2, 1, 1, 1}, false},
{[]interface{}{2001}, false}, {[]interface{}{2001}, false},
{[]interface{}{}, false}, {[]interface{}{}, false},
{[]interface{}{t}, []int{}}, {[]interface{}{t}, false},
{nil, false}, {nil, false},
} { } {