Help us shape the future of Go! Take the 2026 Go Developer Survey

email

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package email provides assertions for the opt-in memory email driver. Failure text deliberately excludes private message contents and recipient addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCount

func AssertCount(t TestingT, driver *memory.Driver, want int)

AssertCount reports a test error when the recorded message count differs from want.

func AssertNotSent

func AssertNotSent(t TestingT, driver *memory.Driver, match func(email.Message) bool)

AssertNotSent requires that no recorded message satisfies match.

func AssertRecipientCount

func AssertRecipientCount(t TestingT, driver *memory.Driver, recipient email.Address, want int)

AssertRecipientCount reports a test error when the count of messages addressed to the mailbox differs from want.

func AssertSent

func AssertSent(t TestingT, driver *memory.Driver, match func(email.Message) bool)

AssertSent requires at least one recorded message satisfying match (nil matches any). Failure text never includes message content or addresses.

func AssertSentCount

func AssertSentCount(t TestingT, driver *memory.Driver, match func(email.Message) bool, want int)

AssertSentCount requires exactly want recorded messages satisfying match.

func New

func New(t testing.TB, capacity int) *memory.Driver

New supplies a fresh bounded production memory driver and owns its cleanup. Pass it explicitly to the normal mailer; no external delivery is attempted.

Types

type TestingT

type TestingT interface {
	// Helper marks the calling function as a test helper.
	Helper()
	// Errorf reports a formatted test failure.
	Errorf(string, ...any)
}

TestingT is the test reporting contract used by email assertions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL