MCPcopy Create free account
hub / github.com/github/gh-aw / TestMergeUnique

Function TestMergeUnique

pkg/sliceutil/sliceutil_test.go:301–328  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

299}
300
301func TestMergeUnique(t *testing.T) {
302 tests := []struct {
303 name string
304 base []string
305 extra []string
306 expected []string
307 }{
308 {
309 name: "deduplicates base and extra preserving first seen order",
310 base: []string{"a", "b", "a"},
311 extra: []string{"b", "c", "a", "d"},
312 expected: []string{"a", "b", "c", "d"},
313 },
314 {
315 name: "nil base with extra values",
316 base: nil,
317 extra: []string{"x", "x", "y"},
318 expected: []string{"x", "y"},
319 },
320 }
321
322 for _, tt := range tests {
323 t.Run(tt.name, func(t *testing.T) {
324 result := MergeUnique(tt.base, tt.extra...)
325 assert.Equal(t, tt.expected, result, "MergeUnique should return deduplicated merged slice")
326 })
327 }
328}
329
330func TestExclude(t *testing.T) {
331 tests := []struct {

Callers

nothing calls this directly

Calls 2

MergeUniqueFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected