Documentation ¶
Index ¶
- func AssertContains(t *testing.T, expected string, actual string)
- func AssertGoldenOutput(t *testing.T, testName string, goldenFile string, output string)
- func DeleteTempDir(dir string)
- func Dt(s string) time.Time
- func DtUtc(s string) time.Time
- func Dts(t time.Time) string
- func Dtt(s string) time.Time
- func Dtts(t time.Time) string
- func FullTestdataPath(filenameOrPartialPath string) string
- func MakeTempDir(dirName string) string
- func MockSimpleJSONResponse(response string) *httptest.Server
- func ReadTestdata(t *testing.T, testName string, path string) string
- func ToJSON(any interface{}) string
- func Tts(t time.Time) string
- func WriteTestdata(t *testing.T, testName string, path string, data string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertContains ¶
AssertContains checks if the actual string contains the expected string.
func AssertGoldenOutput ¶
AssertGoldenOutput reads the expected output of a test from goldenFile and checks that the actual ouput matches.
func DeleteTempDir ¶
func DeleteTempDir(dir string)
DeleteTempDir deteles the temporary directory and all its content.
func FullTestdataPath ¶
FullTestdataPath returns the full path of a testdata file, given a partial path (usually just the filename). E.g.: GetTestdataFile('my_testdata.txt') -> testdata/my_testdata.txt
func MakeTempDir ¶
MakeTempDir creates a temporary directory with name dirName. Don't forget to call defer DeleteTempDir to get rid of it at the end of the test.
func MockSimpleJSONResponse ¶
MockSimpleJSONResponse sets up a test http server which responds with the passed JSON response for all requests.
func ReadTestdata ¶
ReadTestdata reads a file from the current package's testdata/ folder.
Types ¶
This section is empty.