xtest

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFileToFs

func AddFileToFs(t *testing.T, filename string, content []byte, baseFs afero.Fs)

AddFileToFs creates a file with the given filename filled with the content on the baseFs

func AddFileToFsByName

func AddFileToFsByName(t *testing.T, filename, subset string, baseFs afero.Fs)

AddFileToFsByName looks for the filename given over the related testdata dir and creates the file on the baseFs Notice the new file will be located in /{filename} path

func CmpIfErr

func CmpIfErr(t *testing.T, err error, old, actual, new interface{}, msg string)

CmpIfErr is the macro which'll take an error and the expected cases (old actual and new) In case of being errored, it'll cmp actual with old (to check if there are undesired changes) Else, it'll cmp actual with new (to check if the changes are correct)

func CmpWithGoldenFile

func CmpWithGoldenFile(t *testing.T, got []byte, goldenFilename, msg string)

CmpWithGoldenFile performs cmp over the goldenFile and the got bytes given Note: avoid testdata/%s when giving the filename

func IOExist

func IOExist(t *testing.T, Fs afero.Fs, sth string, existFunc func(afero.Fs, string) (bool, error)) bool

IOExist wraps afero utility func for checking existances (.DirExists, .Exists) over the given args and handles the error given of given T

func IOReadFile

func IOReadFile(t *testing.T, Fs afero.Fs, sth string) []byte

IOReadFile wraps afero.ReadFile over the given args and handles the error given of given T

func ReadGoldenFile added in v0.2.0

func ReadGoldenFile(t *testing.T, filename string) []byte

func ReadJsonnet

func ReadJsonnet(t *testing.T, name string) []byte

ReadJsonnet reads the jsonnet given from the specified file It'll add the boilerplate of testdata/%s.jsonnet Is the broda of assist.ReadJsonnet, but in a t.Helper() version

func ReaderFromGoldenFile added in v0.2.0

func ReaderFromGoldenFile(t *testing.T, filename string) (*bufio.Reader, func() error)

Types

This section is empty.

Directories

Path Synopsis
Package xload contains testing helpers but for initialization.
Package xload contains testing helpers but for initialization.

Jump to

Keyboard shortcuts

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