[Gambas-user] Coming back to gb.test

Tobias Boege taboege at gmail.com
Fri Apr 3 14:45:11 CEST 2020


On Fri, 03 Apr 2020, Benoît Minisini wrote:
> Maybe I will say rubbish, but if both can be useful, couldn't we make that
> an option ? "Let gb.test catch all errors" or "let the interpreter crash".
> 

With this we would make progress. It doesn't sound like rubbish.

A quick note on implementation: a simple

  If DontCatch Then Error.Propagate()

does _not_ work for this as it raises a new error from the location where
Error.Propagate() is called instead of "rethrowing" the old error as I
imagined would happen. This will close the doors to the deeper stack frames
in which the error happened, so we'd lose the ability to inspect their
local variables and such.

We would need two different versions of the Run() method in [1]: one which
uses Try and one which doesn't and call either depending on the option.

[1] https://gitlab.com/gambas/gambas/-/blob/3c09d70986a95/comp/src/gb.test/.src/TestSuite/TestCase.class#L39

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list