Skip to content

Commit

Permalink
parser: add package test for WithoutAttachments option
Browse files Browse the repository at this point in the history
  • Loading branch information
rorycl committed Feb 8, 2025
1 parent 718ddb6 commit 2f4ad41
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions parser/optspkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ func TestPkgOptVerbose(t *testing.T) {
_ = parser.NewParser(opt)
}

// TestPkgNoAttachments tests to ensure that no attachments are
// processed with the WithoutAttachments option.
func TestPkgNoAttachments(t *testing.T) {
p := parser.NewParser(parser.WithoutAttachments())
c, err := os.Open("testdata/cats.eml")
if err != nil {
t.Fatal(err)
}
e, err := p.Parse(c)
if err != nil {
t.Fatal(err)
}
if len(e.Files) > 0 {
t.Error("expected no files for parser.WithoutAttachments")
}
}

// TestPkgOptFileFilter shows an example of a file filter to only save
// jpeg images from an email.
func TestPkgOptFileFilter(t *testing.T) {
Expand Down

0 comments on commit 2f4ad41

Please sign in to comment.