(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestAttachmentAt_Bounds(t *testing.T) { |
| 57 | raw := sampleMultipart() |
| 58 | if _, ok := AttachmentAt(raw, 0); !ok { |
| 59 | t.Error("index 0 should exist") |
| 60 | } |
| 61 | if a, ok := AttachmentAt(raw, 1); !ok || a.Filename != "logo.png" { |
| 62 | t.Errorf("index 1 should be logo.png, got ok=%v %+v", ok, a) |
| 63 | } |
| 64 | if _, ok := AttachmentAt(raw, 2); ok { |
| 65 | t.Error("index 2 is out of range, want ok=false") |
| 66 | } |
| 67 | if _, ok := AttachmentAt(raw, -1); ok { |
| 68 | t.Error("negative index, want ok=false") |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func TestAttachments_NoneOnPlainMessage(t *testing.T) { |
| 73 | plain := []byte("From: a@x.com\r\nSubject: hi\r\nContent-Type: text/plain\r\n\r\njust text, no attachments\r\n") |
nothing calls this directly
no test coverage detected