@@ -678,6 +678,42 @@ func TestToIntSliceE(t *testing.T) {
678678 }
679679}
680680
681+ func TestToInt64SliceE (t * testing.T ) {
682+ c := qt .New (t )
683+
684+ tests := []struct {
685+ input interface {}
686+ expect []int64
687+ iserr bool
688+ }{
689+ {[]int {1 , 3 }, []int64 {1 , 3 }, false },
690+ {[]interface {}{1.2 , 3.2 }, []int64 {1 , 3 }, false },
691+ {[]string {"2" , "3" }, []int64 {2 , 3 }, false },
692+ {[2 ]string {"2" , "3" }, []int64 {2 , 3 }, false },
693+ // errors
694+ {nil , nil , true },
695+ {testing.T {}, nil , true },
696+ {[]string {"foo" , "bar" }, nil , true },
697+ }
698+
699+ for i , test := range tests {
700+ errmsg := qt .Commentf ("i = %d" , i ) // assert helper message
701+
702+ v , err := ToInt64SliceE (test .input )
703+ if test .iserr {
704+ c .Assert (err , qt .IsNotNil )
705+ continue
706+ }
707+
708+ c .Assert (err , qt .IsNil )
709+ c .Assert (v , qt .DeepEquals , test .expect , errmsg )
710+
711+ // Non-E test
712+ v = ToInt64Slice (test .input )
713+ c .Assert (v , qt .DeepEquals , test .expect , errmsg )
714+ }
715+ }
716+
681717func TestToFloat64SliceE (t * testing.T ) {
682718 c := qt .New (t )
683719
0 commit comments