mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-25 15:10:48 +01:00
Winni Neessen
31001e87b2
# SUMMARY * Bad licenses: * Deprecated licenses: * Licenses without file extension: * Missing licenses: * Unused licenses: * Used licenses: CC0-1.0, MIT * Read errors: 0 * Files with copyright information: 45 / 45 * Files with license information: 45 / 45 Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)
32 lines
864 B
Go
32 lines
864 B
Go
// SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev>
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package mail
|
|
|
|
import "testing"
|
|
|
|
// TestFile_SetGetHeader tests the set-/getHeader method of the File object
|
|
func TestFile_SetGetHeader(t *testing.T) {
|
|
f := File{
|
|
Name: "testfile.txt",
|
|
Header: make(map[string][]string),
|
|
}
|
|
f.setHeader(HeaderContentType, "text/plain")
|
|
fi, ok := f.getHeader(HeaderContentType)
|
|
if !ok {
|
|
t.Errorf("getHeader method of File did not return a value")
|
|
return
|
|
}
|
|
if fi != "text/plain" {
|
|
t.Errorf("getHeader returned wrong value. Expected: %s, got: %s", "text/plain", fi)
|
|
}
|
|
fi, ok = f.getHeader(HeaderContentTransferEnc)
|
|
if ok {
|
|
t.Errorf("getHeader method of File did return a value, but wasn't supposed to")
|
|
return
|
|
}
|
|
if fi != "" {
|
|
t.Errorf("getHeader returned wrong value. Expected: %s, got: %s", "", fi)
|
|
}
|
|
}
|