Documentation
¶
Overview ¶
Package testutil provides helpers for unit tests.
Index ¶
- func AssertBool(t *testing.T, want, have bool)
- func AssertEqual(t *testing.T, want, have interface{})
- func AssertErrorContains(t *testing.T, err error, target string)
- func AssertNoError(t *testing.T, err error)
- func AssertRemediationErrorContains(t *testing.T, err error, target string)
- func AssertString(t *testing.T, want, have string)
- func AssertStringContains(t *testing.T, s, substr string)
- func MakeTempFile(t *testing.T, contents string) string
- func MustParseTimeRFC3339(s string) *time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertBool ¶
AssertBool fatals a test if the parameters aren't equal.
func AssertEqual ¶ added in v0.9.0
AssertEqual fatals a test if the parameters aren't equal.
func AssertErrorContains ¶
AssertErrorContains fatals a test if the error's Error string doesn't contain target. As a special case, if target is the empty string, we assume the error should be nil.
func AssertNoError ¶
AssertNoError fatals a test if the error is not nil.
func AssertRemediationErrorContains ¶ added in v0.8.0
AssertRemediationErrorContains fatals a test if the error's RemediationError remediation string doesn't contain target. As a special case, if target is the empty string, we assume the error should be nil.
func AssertString ¶
AssertString fatals a test if the parameters aren't equal.
func AssertStringContains ¶
AssertStringContains fatals a test if the string doesn't contain a substring.
func MakeTempFile ¶ added in v0.21.0
MakeTempFile creates a tempfile with the given contents and returns its path
func MustParseTimeRFC3339 ¶
MustParseTimeRFC3339 is a small helper to initialize time constants.
Types ¶
This section is empty.