Documentation
¶
Overview ¶
Yet another pithy testing framework `actually`
Index ¶
- func Actual(g any) *testingA
- func Diff(a any, b any) string
- func Dump(a any) string
- func Expect(e any) *testingA
- func Expectf(format string, e ...any) *testingA
- func Fail(t *testing.T, reason string, got any, expect ...any)
- func FailNotNowOn(t *testing.T)
- func FailNow(t *testing.T, reason string, got any, expect ...any)
- func FailNowOn(t *testing.T)
- func Fatal(t *testing.T, reason string, got any, expect ...any)
- func FatalOn(t *testing.T)
- func Got(g any) *testingA
- func GotError(g error) *testingA
- func Skip(t *testing.T, skipReasons ...any)
- func Want(e any) *testingA
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶ added in v0.12.0
Diff is a helper function to get a diff string of 2 objects for debugging
func Dump ¶ added in v0.23.0
Dump is a helper function to get a dumped string of an object for debugging
func Expect ¶
func Expect(e any) *testingA
Expect sets the value you expect to be the same as the one you got. Expect creates *testingA and returns it.
func Expectf ¶ added in v0.26.0
Expectf sets the formatted string value you expect to be the same as the one you got. Expectf creates *testingA and returns it.
func Fail ¶ added in v0.21.0
Fail is to show decorated fail report. (Actual shortcut to witness.Fail)
if g != e { actually.Fail(t, "Not same", g, e) }
func FailNotNowOn ¶ added in v0.13.0
FailNotNowOn function turns an ENV flag off to stop further test execution immediately if one test fails. If you want to turn the ENV flag on, then you should call `FailNowOn`.
func Test(t *testing.T) { // turn on to fail right now actually.FailNowOn(t) actually.Got(something).Nil(t) // Fail Now actually.Got(something).Expect(something).Same(t) // Fail Now // turn off actually.FailNotNowOn(t) actually.Got(something).Nil(t) // NOT Fail Now actually.Got(something).Expect(something).Same(t) // NOT Fail Now // Fail Now by FailNow() in the chain actually.Got(something).FailNow().Nil(t) // Fail Now // Again, turn on to fail right now actually.FailNowOn(t) actually.Got(something).Nil(t) // Fail Now }
This switch is enabled within the test. Not only during function.
func FailNow ¶ added in v0.21.0
FailNow is to show decorated fail report by t.Fatal. (Actual shortcut to witness.FailNow)
if g != e { actually.FailNow(t, "Not same", g, e) }
func FailNowOn ¶ added in v0.13.0
FailNowOn function turns an ENV flag on to stop further test execution immediately if one test fails. This switch is enabled within the test. Not only during function.
func Test(t *testing.T) { actually.FailNowOn(t) actually.Got(something).Nil(t) // Fail Now actually.Got(something).Expect(something).Same(t) // Fail Now }
Warning: Do not use FailNowOn along with t.Parallel.
func Got ¶
func Got(g any) *testingA
Got sets the value you actually got. Got() creates *testingA and returns it.
func GotError ¶ added in v0.13.0
func GotError(g error) *testingA
GotError sets the error value you actually got. GotError creates `*testingA` and returns it.
Types ¶
This section is empty.