60052c6070
Append all non-multipart attachments with the -A flag. Rename the flag for forwarding a full message as an RFC2822 attachments to -F. Suggested-by: psykose Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
46 lines
904 B
Go
46 lines
904 B
Go
package lib_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.sr.ht/~rjarry/aerc/lib"
|
|
"git.sr.ht/~rjarry/aerc/models"
|
|
)
|
|
|
|
func TestLib_FindAllNonMultipart(t *testing.T) {
|
|
|
|
testStructure := &models.BodyStructure{
|
|
MIMEType: "multipart",
|
|
Parts: []*models.BodyStructure{
|
|
&models.BodyStructure{},
|
|
&models.BodyStructure{
|
|
MIMEType: "multipart",
|
|
Parts: []*models.BodyStructure{
|
|
&models.BodyStructure{},
|
|
&models.BodyStructure{},
|
|
},
|
|
},
|
|
&models.BodyStructure{},
|
|
},
|
|
}
|
|
|
|
expected := [][]int{
|
|
[]int{1},
|
|
[]int{2, 1},
|
|
[]int{2, 2},
|
|
[]int{3},
|
|
}
|
|
|
|
parts := lib.FindAllNonMultipart(testStructure, nil, nil)
|
|
|
|
if len(expected) != len(parts) {
|
|
t.Errorf("incorrect dimensions; expected: %v, got: %v", expected, parts)
|
|
}
|
|
|
|
for i := 0; i < len(parts); i++ {
|
|
if !lib.EqualParts(expected[i], parts[i]) {
|
|
t.Errorf("incorrect values; expected: %v, got: %v", expected[i], parts[i])
|
|
}
|
|
}
|
|
|
|
}
|