util/array_test.go

22 lines
526 B
Go
Raw Normal View History

2023-03-30 14:49:38 +08:00
// Package util ...
//
// Description : util ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2023-03-30 14:43
package util
import (
"testing"
2023-03-30 16:22:56 +08:00
"github.com/stretchr/testify/assert"
2023-03-30 14:49:38 +08:00
)
func Test_array_In(t *testing.T) {
2023-03-30 16:22:56 +08:00
//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}))
2023-03-30 14:49:38 +08:00
}