22 lines
526 B
Go
22 lines
526 B
Go
// Package util ...
|
|
//
|
|
// Description : util ...
|
|
//
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
//
|
|
// Date : 2023-03-30 14:43
|
|
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_array_In(t *testing.T) {
|
|
//assert.Equal(t, -1, Array.In(1234, []string{"1234", "123", "1"}))
|
|
assert.Equal(t, 0, Array.In(1234, []interface{}{1234, "123", "1"}))
|
|
//assert.Equal(t, -1, Array.In(nil, []interface{}{1234, "123", "1"}))
|
|
//assert.Equal(t, 3, Array.In(nil, []interface{}{1234, "123", "1", nil}))
|
|
}
|