package mail import "testing" func TestMergeSlice(t *testing.T) { got := MergeSlice([]string{"a@t.com", "b@t.com"}, []string{"c@t.com"}) if len(got) != 3 { t.Fatalf("MergeSlice 长度 = %d, want 3", len(got)) } want := map[string]bool{"a@t.com": true, "b@t.com": true, "c@t.com": true} for _, s := range got { if !want[s] { t.Errorf("MergeSlice 结果包含意外元素 %q", s) } } } func TestMergeSliceEmpty(t *testing.T) { if got := MergeSlice(nil, nil); len(got) != 0 { t.Errorf("空输入 MergeSlice = %v, want 空", got) } }