-
Notifications
You must be signed in to change notification settings - Fork 0
Helper functions
bayashi edited this page Oct 5, 2025
·
11 revisions
Add a name of test.
actually.Got(v).Name("v is true").True(t)Also you can add a test on 2nd arg of assertion methods.
actually.Got(v).True(t, "v is true")actually.Skip(t)Skip is a shorthand for -short option on running a test.
if res := actually.Got(true).False(t).Fi(); !res {
// your own some action on fail
}Fi returns whether a test failed as boolean.
If you additionally call X, then a stringified raw data will be shown on fail. It would be helpful for complecated string which including multiple \t or \n.
actually.Got(v).X().True(t)You can get diff of 2 objects on anywhere. If these are objects, then these will be compared as dumped data.
t.Log(actually.Diff(a, b))You can get dumped string of an object on anywhere.
t.Log(actually.Dump(a))You can show debug info only on fail.
actually.Got(g).Expect(e).Debug("label", someInfo).Same(t)someInfo will be dumped in fail report nicely.
actually.Got(v).FailNow().True(t)actually.FailNow(func() {
actually.Got(false).True(t)
actually.Got(true).False(t) // not executed
})