@@ -1,158 +0,0 @@
6− "github.com/stretchr/testify/require"
9−func TestIsSubset(t *testing.T) {
16− // Basic subset cases
18− name: "empty subset of empty",
24− name: "empty subset of non-empty",
26− b: []string{"a", "b", "c"},
30− name: "non-empty not subset of empty",
36− name: "single element subset",
38− b: []string{"a", "b", "c"},
42− name: "single element not subset",
44− b: []string{"a", "b", "c"},
48− name: "multiple elements subset",
49− a: []string{"a", "c"},
50− b: []string{"a", "b", "c", "d"},
54− name: "multiple elements not subset",
55− a: []string{"a", "e"},
56− b: []string{"a", "b", "c", "d"},
60− name: "equal sets are subsets",
61− a: []string{"a", "b", "c"},
62− b: []string{"a", "b", "c"},
66− name: "larger set not subset of smaller",
67− a: []string{"a", "b", "c", "d"},
68− b: []string{"a", "b"},
72− // Order independence
74− name: "subset with different order",
75− a: []string{"c", "a"},
76− b: []string{"b", "a", "d", "c"},
80− // Duplicate handling
82− name: "duplicates in subset",
83− a: []string{"a", "a", "b"},
84− b: []string{"a", "b", "c"},
88− name: "duplicates in superset",
89− a: []string{"a", "b"},
90− b: []string{"a", "a", "b", "b", "c"},
94− name: "duplicates in both",
95− a: []string{"a", "a", "b"},
96− b: []string{"a", "a", "b", "b", "c"},
100− // Real-world examples
102− name: "npm flags subset",
104− b: []string{"-g", "--verbose", "--save-dev"},
108− name: "npm flags not subset",
109− a: []string{"--global"},
110− b: []string{"-g", "--verbose", "--save-dev"},
115− for _, tt := range tests {
116− t.Run(tt.name, func(t *testing.T) {
117− result := IsSubset(tt.a, tt.b)
118− require.Equal(t, tt.expect, result,
119− "IsSubset(%v, %v) should be %v", tt.a, tt.b, tt.expect)
124−func TestIsSubsetWithInts(t *testing.T) {
134− b: []int{1, 2, 3, 4},
138− name: "int not subset",
140− b: []int{1, 2, 3, 4},
144− name: "empty int subset",
151− for _, tt := range tests {
152− t.Run(tt.name, func(t *testing.T) {
153− result := IsSubset(tt.a, tt.b)
154− require.Equal(t, tt.expect, result,
155− "IsSubset(%v, %v) should be %v", tt.a, tt.b, tt.expect)