Documentation
¶
Overview ¶
Package expect provides a set of simple concrete test.Comparator implementations to use by tests on stdout, along with exit code expectations.
Index ¶
- Constants
- func All(comparators ...test.Comparator) test.Comparator
- func Contains(compare string, more ...string) test.Comparator
- func DoesNotContain(compare string, more ...string) test.Comparator
- func DoesNotMatch(reg *regexp.Regexp) test.Comparator
- func Equals(compare string) test.Comparator
- func JSON[T any](obj T, verifier func(T, tig.T)) test.Comparator
- func Match(reg *regexp.Regexp) test.Comparator
Constants ¶
View Source
const ( // ExitCodeSuccess will ensure that the command effectively ran returned with exit code zero. ExitCodeSuccess = 0 // ExitCodeSigkill verifies a container exited due to SIGKILL. ExitCodeSigkill = 137 // ExitCodeGenericFail will verify that the command ran and exited with a non-zero error code. // This does NOT include timeouts, cancellation, or signals. ExitCodeGenericFail = -10 // ExitCodeNoCheck does not enforce any check at all on the function. ExitCodeNoCheck = -11 // ExitCodeTimeout verifies that the command was cancelled on timeout. ExitCodeTimeout = -12 // ExitCodeSignaled verifies that the command has been terminated by a signal. ExitCodeSignaled = -13 )
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All(comparators ...test.Comparator) test.Comparator
All can be used as a parameter for expected.Output to group a set of comparators.
func Contains ¶
func Contains(compare string, more ...string) test.Comparator
Contains can be used as a parameter for expected.Output and ensures a comparison string is found contained in the output.
func DoesNotContain ¶
func DoesNotContain(compare string, more ...string) test.Comparator
DoesNotContain is to be used for expected.Output to ensure a comparison string is NOT found in the output.
func DoesNotMatch ¶
func DoesNotMatch(reg *regexp.Regexp) test.Comparator
DoesNotMatch returns a comparator verifying the output does not match the provided regexp.
func Equals ¶
func Equals(compare string) test.Comparator
Equals is to be used for expected.Output to ensure it is exactly the output.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.