require

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MPL-2.0, MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirsMatch

func DirsMatch(t *testing.T, expectedName, actualName string, lrs ...ReaderLineReplacer)

func FileStringContains

func FileStringContains(t *testing.T, name string, expected ...string)

func FilesMatch

func FilesMatch(t *testing.T, expectedName, actualName string, lrs ...ReaderLineReplacer)

func MatchRegexp

func MatchRegexp(t *testing.T, subject string, expectedReStr ...string)

func ReaderStringContains

func ReaderStringContains(t *testing.T, r io.Reader, expected ...string)

func ReadersMatch

func ReadersMatch(t *testing.T, expectedName string, expected io.Reader, actualName string, actual io.Reader, lrs ...ReaderLineReplacer)

func StringContains

func StringContains(t *testing.T, subject string, expected ...string)

func StringSliceExactly

func StringSliceExactly(t *testing.T, expected []string, actual []string)

func StringSortedSliceExactly

func StringSortedSliceExactly(t *testing.T, expected []string, actual []string)

Types

type ReaderLineReplacer

type ReaderLineReplacer func(expectedName, actualName, actualLine string) (replacement string)

ReaderLineReplacer receives an "actual" line, from an expected vs. actual test comparison, and optionally returns a new "actual" line value.

For example, if the actual values will change over time (e.g. "go <semver>" strings in new go.mod files), a ReaderLineReplacer can allow test fixtures to have out-dated semver values (which are not the SUT) by replacing the dynamic value with the expected static value.

The expectedName and actualName values are the reader (e.g. file) names.

Jump to

Keyboard shortcuts

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