You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some helper functions that do certain tests and return helpful output as en
error. To preserve helpful line numbers I have to do this every time:
if e := test.Equals(obtained, expected); e != nil {
t.Fatal(e)
}
Something like this would be helpful:
t.Assert(test.Equals(obtained, expected))
Could look something like this:
func (c *common) Assert(err ...error) {
args := make([]error, 0, len(errs))
for _, e := range err {
if e != nil {
args = append(args, e)
}
}
if len(args) > 0 {
c.log(fmt.Sprintln(args...))
c.FailNow()
}
}
Or even this:
func (c *common) Assert(err error) {
if err != nil {
c.log(err.Error())
c.FailNow()
}
}
Activity
robpike commentedon Dec 26, 2013
Comment 1:
Status changed to WorkingAsIntended.