| 21 | ) |
| 22 | |
| 23 | func TestIsEmpty(t *testing.T) { |
| 24 | tests := []struct { |
| 25 | name string |
| 26 | input interface{} |
| 27 | expected bool |
| 28 | }{ |
| 29 | { |
| 30 | name: "nil slice", |
| 31 | input: nil, |
| 32 | expected: true, |
| 33 | }, |
| 34 | { |
| 35 | name: "empty string slice", |
| 36 | input: []string{}, |
| 37 | expected: true, |
| 38 | }, |
| 39 | { |
| 40 | name: "non-empty string slice", |
| 41 | input: []string{"a", "b"}, |
| 42 | expected: false, |
| 43 | }, |
| 44 | { |
| 45 | name: "empty int slice", |
| 46 | input: []int{}, |
| 47 | expected: true, |
| 48 | }, |
| 49 | { |
| 50 | name: "non-empty int slice", |
| 51 | input: []int{1, 2, 3}, |
| 52 | expected: false, |
| 53 | }, |
| 54 | } |
| 55 | |
| 56 | for _, tt := range tests { |
| 57 | t.Run(tt.name, func(t *testing.T) { |
| 58 | result := IsEmpty(tt.input) |
| 59 | assert.Equal(t, tt.expected, result) |
| 60 | }) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func TestJoinWithSeparator(t *testing.T) { |
| 65 | tests := []struct { |