Helper functions - bayashi/actually GitHub Wiki
Name
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")
Skip
actually.Skip(t)
Skip is a shorthand for -short option on running a test.
Fi
if res := actually.Got(true).False(t).Fi(); !res {
// your own some action on fail
}
Fi returns whether a test failed as boolean.
X
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)
Diff
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))
Dump
You can get dumped string of an object on anywhere.
t.Log(actually.Dump(a))
Debug
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.
Wrapper functions of testing module
FailNow
actually.Got(v).FailNow().True(t)
FailNow in bulk
actually.FailNow(func() {
actually.Got(false).True(t)
actually.Got(true).False(t) // not executed
})