MCPcopy
hub / github.com/harness/harness / TestIsEmpty

Function TestIsEmpty

registry/app/pkg/utils_test.go:23–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func 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
64func TestJoinWithSeparator(t *testing.T) {
65 tests := []struct {

Callers

nothing calls this directly

Calls 3

EqualMethod · 0.80
IsEmptyFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…