package threading import ( "reflect" "testing" ) func TestNormalizeMessageID(t *testing.T) { tests := []struct { in, want string }{ {"", ""}, {"", ""}, {"a@b", ""}, } for _, tc := range tests { if got := NormalizeMessageID(tc.in); got != tc.want { t.Fatalf("NormalizeMessageID(%q) = %q, want %q", tc.in, got, tc.want) } } } func TestParseMessageIDs(t *testing.T) { got := ParseMessageIDs(" ") want := []string{"", ""} if !reflect.DeepEqual(got, want) { t.Fatalf("ParseMessageIDs() = %v, want %v", got, want) } } func TestBuildReferences(t *testing.T) { got := BuildReferences("", []string{"", ""}) want := []string{"", "", ""} if !reflect.DeepEqual(got, want) { t.Fatalf("BuildReferences() = %v, want %v", got, want) } } func TestNormalizeMessageID_imapEnvelopeWithoutBrackets(t *testing.T) { // go-imap Envelope.MessageID is documented without angle brackets. if got := NormalizeMessageID("abc@host.test"); got != "" { t.Fatalf("NormalizeMessageID() = %q, want %q", got, "") } } func TestBuildReferences_dedupesParent(t *testing.T) { got := BuildReferences("", []string{"", ""}) want := []string{"", ""} if !reflect.DeepEqual(got, want) { t.Fatalf("BuildReferences() = %v, want %v", got, want) } }