test

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PartExists = &enmime.Part{}

PartExists indicates to ComparePart that this part is expect to exist

Functions

func CompareEnvelope

func CompareEnvelope(t *testing.T, got *enmime.Envelope, want *enmime.Envelope) (equal bool)

CompareEnvelope test helper compares the attributes of two envelopes, returning true if they are equal. t.Errorf() will be called for each field that is not equal. The presence of child and siblings will be checked, but not the attributes of them. Unexported fields are ignored.

func ComparePart

func ComparePart(t *testing.T, got *enmime.Part, want *enmime.Part) (equal bool)

ComparePart test helper compares the attributes of two parts, returning true if they are equal. t.Errorf() will be called for each field that is not equal. The presence of child and siblings will be checked, but not the attributes of them. Header, Errors and unexported fields are ignored.

func ContentContainsString

func ContentContainsString(t *testing.T, b []byte, substr string)

ContentContainsString checks if the provided readers content contains the specified substring

func ContentEqualsBytes

func ContentEqualsBytes(t *testing.T, b []byte, want []byte)

ContentEqualsBytes checks if the provided readers content is the specified []byte

func ContentEqualsString

func ContentEqualsString(t *testing.T, b []byte, str string)

ContentEqualsString checks if the provided readers content is the specified string

func DiffGolden

func DiffGolden(t *testing.T, got []byte, path ...string)

DiffGolden does a line by comparison of got to the golden file specified by path. If the update flag is true, differing golden files will be updated with lines in got.

func DiffLines

func DiffLines(t *testing.T, got []byte, want []byte)

DiffLines does a line by line comparison of got and want.

func DiffStrings

func DiffStrings(t *testing.T, got []string, want []string)

DiffStrings does a entry by entry comparison of got and want.

func OpenTestData

func OpenTestData(subdir, filename string) io.Reader

OpenTestData is a utility function to open a file in testdata for reading, it will panic if there is an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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