Documentation ¶
Index ¶
- func RunTest(t *testing.T, fun any, cases ...TestCase)
- func TTA(args ...interface{}) []interface{}
- func ToTestArgs(args ...interface{}) []interface{}
- type MockTestFunction
- type TestCase
- type TestCasesSuite
- type TestErrorExpected
- type TestExpected
- func TTCEE() TestExpected
- func TTE(checkError bool, err error, withPanic bool, panicMsg string, ...) TestExpected
- func TTEE(err error) TestExpected
- func TTPEE(msg interface{}) TestExpected
- func TTVE(expedites ...interface{}) TestExpected
- func TTVEWNE(expedites ...interface{}) TestExpected
- func ToTestCheckErrorExpected() TestExpected
- func ToTestErrorExpected(err error) TestExpected
- func ToTestExpected(checkError bool, err error, withPanic bool, panicMsg interface{}, ...) TestExpected
- func ToTestPanicErrorExpected(msg interface{}) TestExpected
- func ToTestValuesExpected(expedites ...interface{}) TestExpected
- func ToTestValuesExpectedWithNilError(expedites ...interface{}) TestExpected
- type TestPanicErrorExpected
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TTA ¶
func TTA(args ...interface{}) []interface{}
TTA is a wrapper over a function ToTestArgs to shorten its name
func ToTestArgs ¶
func ToTestArgs(args ...interface{}) []interface{}
ToTestArgs is a small function to convert a list of args to an array of []interfaces{} It can be easier write ToTestArgs(a, b, c) then []interface{}{a, b, c}.
Types ¶
type MockTestFunction ¶
type MockTestFunction func(ctrl *gomock.Controller) []interface{}
MockTestFunction is a interface of function to initialize mocks for a test case
type TestCase ¶
type TestCase struct { Name string // Name of test Args []interface{} // Args of testing function Expected TestExpected // Info about expected return of testing function InitMocks MockTestFunction // For Mock initialization !!!future }
TestCase is a structure describing the test case
type TestCasesSuite ¶
TestCasesSuite is a wrapper over a suite.Suite with added methods for run test cases.
func (*TestCasesSuite) RunTest ¶
func (s *TestCasesSuite) RunTest(fun any, cases ...TestCase)
RunTest is a function to run a list of test cases for the tested function
type TestErrorExpected ¶
type TestErrorExpected struct { CheckError bool // indication that it is only necessary to check // for an error, without checking for a match with the expected one Error error // expected error }
TestErrorExpected is a struct contained info about expected returns of tested function
type TestExpected ¶
type TestExpected struct { PanicError *TestPanicErrorExpected // expected panic message of tested function Error *TestErrorExpected // expected error of tested function ExpectedReturns []interface{} // expected returns of tested function }
TestExpected is a struct contained info about expected returns of tested function
func TTCEE ¶
func TTCEE() TestExpected
TTCEE is a wrapper over a function ToTestCheckErrorExpected to shorten its name
func TTE ¶
func TTE(checkError bool, err error, withPanic bool, panicMsg string, expedites ...interface{}, ) TestExpected
TTE is a wrapper over a function ToTestExpected to shorten its name
func TTEE ¶
func TTEE(err error) TestExpected
TTEE is a wrapper over a function ToTestErrorExpected to shorten its name
func TTPEE ¶
func TTPEE(msg interface{}) TestExpected
TTPEE is a wrapper over a function ToTestPanicErrorExpected to shorten its name
func TTVE ¶
func TTVE(expedites ...interface{}) TestExpected
TTVE is a wrapper over a function ToTestValuesExpected to shorten its name
func TTVEWNE ¶
func TTVEWNE(expedites ...interface{}) TestExpected
TTVEWNE is a wrapper over a function ToTestValuesExpectedWithNilError to shorten its name
func ToTestCheckErrorExpected ¶
func ToTestCheckErrorExpected() TestExpected
ToTestCheckErrorExpected is a function to construct test exception with only waiting for the not specified error as the result of the function under test
func ToTestErrorExpected ¶
func ToTestErrorExpected(err error) TestExpected
ToTestErrorExpected is a function to construct test exception with only waiting for the specified error as the result of the function under test
func ToTestExpected ¶
func ToTestExpected(checkError bool, err error, withPanic bool, panicMsg interface{}, expedites ...interface{}, ) TestExpected
ToTestExpected is a function to construct test exception all variant of waiting results of the function under test
func ToTestPanicErrorExpected ¶
func ToTestPanicErrorExpected(msg interface{}) TestExpected
ToTestPanicErrorExpected is a function to construct test exception with only waiting for the panic message as the result of the function under test
func ToTestValuesExpected ¶
func ToTestValuesExpected(expedites ...interface{}) TestExpected
ToTestValuesExpected is a function to construct test exception with only waiting for the specified arguments and no one error as the result of the function under test
func ToTestValuesExpectedWithNilError ¶
func ToTestValuesExpectedWithNilError(expedites ...interface{}) TestExpected
ToTestValuesExpectedWithNilError is a function to construct test exception with only waiting for
the specified arguments and nil error as the result of the function under test
func (*TestExpected) HaveError ¶
func (te *TestExpected) HaveError() bool
HaveError is a function checking if an error is expected
func (*TestExpected) HavePanicError ¶
func (te *TestExpected) HavePanicError() bool
HavePanicError is a function checking if a panic is expected
func (*TestExpected) MustErrorExpected ¶
func (te *TestExpected) MustErrorExpected() TestErrorExpected
MustErrorExpected is a function returning expected error. If it does not exist, function panic with error
func (*TestExpected) MustPanicErrorExpected ¶
func (te *TestExpected) MustPanicErrorExpected() TestPanicErrorExpected
MustPanicErrorExpected is a function returning expected panic error. If it does not exist, function panic with error
type TestPanicErrorExpected ¶
type TestPanicErrorExpected struct {
Msg interface{} // expected message
}
TestPanicErrorExpected is a struct contained info about the expected panic message of tested function