Support Apple Mail MBOX export format

This commit is contained in:
Michal Horejsek
2020-10-22 13:46:03 +02:00
parent fe5f73d96e
commit 1286e57b63
8 changed files with 105 additions and 6 deletions

View File

@ -39,6 +39,7 @@ func TestGetFolderNames(t *testing.T) {
"",
[]string{
"bar",
"bar.mbox",
"baz",
filepath.Base(root),
"foo",
@ -95,6 +96,13 @@ func TestGetFilePathsWithSuffix(t *testing.T) {
"test/foo/msg9.eml",
},
},
{
".mbox",
[]string{
"bar.mbox",
"foo.mbox",
},
},
{
".txt",
[]string{
@ -109,7 +117,7 @@ func TestGetFilePathsWithSuffix(t *testing.T) {
for _, tc := range tests {
tc := tc
t.Run(tc.suffix, func(t *testing.T) {
paths, err := getFilePathsWithSuffix(root, tc.suffix)
paths, err := getAllPathsWithSuffix(root, tc.suffix)
r.NoError(t, err)
r.Equal(t, tc.wantPaths, paths)
})
@ -125,6 +133,7 @@ func createTestingFolderStructure(t *testing.T) (string, func()) {
"foo/baz",
"test/foo",
"qwerty",
"bar.mbox",
} {
err = os.MkdirAll(filepath.Join(root, path), os.ModePerm)
r.NoError(t, err)
@ -142,6 +151,8 @@ func createTestingFolderStructure(t *testing.T) (string, func()) {
"test/foo/msg9.eml",
"msg10.eml",
"info.txt",
"foo.mbox",
"bar.mbox/mbox", // Apple Mail mbox export format.
} {
f, err := os.Create(filepath.Join(root, path))
r.NoError(t, err)