franela/goblin

Gomega really should not panic...

onsi opened this issue · 0 comments

onsi commented

Gomega handles assertion failures exactly like Goblin's internal assertion library handles assertion failures: by calling a fail method that is provided to it (in Goblin's case it is g.fail which does not panic).

It would be incorrect for Gomega to panic because there is no way for the caller to rescue a panic emitted in a called go routine. This would make your asynchronous test example impossible:

  g.Describe("Numbers", func() {
      g.It("Should add two numbers asynchronously", func(done Done) {
          go func() {
              g.Assert(1+1).Equal(2) //If this line panics there's no way for the test framework to catch it!
              done()
          }()
      })
  })

Would you mind changing the language in the Readme to indicate that this really is not an open issue in Gomega any more? Thanks!