franela / goblin

Minimal and Beautiful Go testing framework
MIT License
884 stars 79 forks source link

Allow multiple `errors` from failed test #86

Closed schmurfy closed 2 years ago

schmurfy commented 4 years ago

I realized after #85 that I made a false assumption: I though multiple messages could be displayed but as it turns ou only one failure can be stored for each test.

The issue is that gomock does that:

failures := ctrl.expectedCalls.Failures()
for _, call := range failures {
  ctrl.T.Errorf("missing call(s) to %v", call)
}
if len(failures) != 0 {
  ctrl.T.Fatalf("aborting test due to missing call(s)")
}

With the Errorf methods introduced by the original testify patch each successive call to Errorf and then Fatalf overwrite the previous one.

Adding support for multiple erros would allow logging non fatal errors like this:

g.Errrof("this should take less than 10ms")
g.Fatalf("X is different than 10")

I can give it a try but is that something that could be merged ?

schmurfy commented 4 years ago

@marcosnils Do you have any opinion on this ?

schmurfy commented 2 years ago

Hello, this is still an issue for me, so... any opinions ?