mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 05:40:50 +01:00
Tests for file.go added
This commit is contained in:
parent
b48b6e0b6a
commit
3f101817ae
1 changed files with 28 additions and 0 deletions
28
file_test.go
Normal file
28
file_test.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
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)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue