testutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

package testutil is internal test helpers package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOnlySubTest

func IsOnlySubTest() (string, bool)

IsOnlySubTest returns name of single subtest that should be run

Types

type ExpectedError

type ExpectedError string

ExpectedError is string which should be in expected error

func (ExpectedError) AssertError

func (x ExpectedError) AssertError(t *testing.T, err error) bool

AssertError checks if error contains expected string.

Returns true if no errors expected or got and test can be continued.

Example:

if !wantErr.AssertError(t, err) {
	// Some error in test expected, so just exit
	return
}
assert.Equal(t, want, got)

func (ExpectedError) Empty

func (x ExpectedError) Empty() bool

Empty returns if expected string is empty

type FixtureFromString

type FixtureFromString string

FixtureFromString indicates that source is plain string

func (FixtureFromString) ProvideFixture

func (j FixtureFromString) ProvideFixture(t *testing.T) []byte

ProvideFixture implements FixtureProvider

type FixtureProvider

type FixtureProvider interface {
	ProvideFixture(t *testing.T) []byte
}

FixtureProvider is test fixture provider

type TestdataFixture

type TestdataFixture string

TestdataFixture indicates that source should be taken from file in testdata dir

func (TestdataFixture) ProvideFixture

func (j TestdataFixture) ProvideFixture(t *testing.T) []byte

ProvideFixture implements FixtureProvider

Jump to

Keyboard shortcuts

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