Files
go-easy-utils/sliceUtil/is_slice_test.go
2023-04-03 13:22:18 +08:00

25 lines
470 B
Go

package sliceUtil
import "testing"
func TestIsSlice(t *testing.T) {
var tests = []struct {
input interface{}
want bool
}{
{[]int{1, 1, 3}, true},
{[]interface{}{1, 2, "a"}, true},
{[]map[string]interface{}{
{"1": 1},
{"c": 89},
}, true},
{"1234", false},
{make(chan int), false},
}
for _, test := range tests {
if got := IsSlice(test.input); got != test.want {
t.Errorf("IsSlice(%v) = %v; want %v", test.input, got, test.want)
}
}
}