mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-08 00:10:05 +08:00
25 lines
446 B
Go
25 lines
446 B
Go
package sliceUtil
|
|
|
|
import "testing"
|
|
|
|
func TestIsSlice(t *testing.T) {
|
|
var tests = []struct {
|
|
input any
|
|
want bool
|
|
}{
|
|
{[]int{1, 1, 3}, true},
|
|
{[]any{1, 2, "a"}, true},
|
|
{[]map[string]any{
|
|
{"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)
|
|
}
|
|
}
|
|
}
|