mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
use slices package and remove some helpers (#17342)
This commit is contained in:
@@ -288,40 +288,6 @@ func TestToS3ETag(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test contains
|
||||
func TestContains(t *testing.T) {
|
||||
testErr := errors.New("test err")
|
||||
|
||||
testCases := []struct {
|
||||
slice interface{}
|
||||
elem interface{}
|
||||
found bool
|
||||
}{
|
||||
{nil, nil, false},
|
||||
{"1", "1", false},
|
||||
{nil, "1", false},
|
||||
{[]string{"1"}, nil, false},
|
||||
{[]string{}, "1", false},
|
||||
{[]string{"1"}, "1", true},
|
||||
{[]string{"2"}, "1", false},
|
||||
{[]string{"1", "2"}, "1", true},
|
||||
{[]string{"2", "1"}, "1", true},
|
||||
{[]string{"2", "1", "3"}, "1", true},
|
||||
{[]int{1, 2, 3}, "1", false},
|
||||
{[]int{1, 2, 3}, 2, true},
|
||||
{[]int{1, 2, 3, 4, 5, 6}, 7, false},
|
||||
{[]error{errors.New("new err")}, testErr, false},
|
||||
{[]error{errors.New("new err"), testErr}, testErr, true},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
found := contains(testCase.slice, testCase.elem)
|
||||
if found != testCase.found {
|
||||
t.Fatalf("Test %v: expected: %v, got: %v", i+1, testCase.found, found)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test ceilFrac
|
||||
func TestCeilFrac(t *testing.T) {
|
||||
cases := []struct {
|
||||
|
||||
Reference in New Issue
Block a user