SUnit error handling discrepancy

Keith Hodges keith_hodges at yahoo.co.uk
Thu Mar 15 20:25:36 UTC 2007


Damien Cassou wrote:
> 2007/3/13, Keith Hodges <keith_hodges at yahoo.co.uk>:
>> 1) should SUnit only trap Unhandled errors, in its error count?
>> 2) Or should #debug trap errors like #run does ?
>
> What is the meaning of #debug: ? Currently I use it in my test
> comments to rapidly execute a test. It's better than #run: because it
> raises a debugger on which I can see what was wrong.
I am sorry I was not clear enough, option 2 should read

2) Or should #debug trap errors like #run does, and open a debugger on 
the caught errors, rather than leaving it to the default handler to open 
the debugger which doesnt always happen.

So if you write a test

testThis
    "self debug:#testThis"
    InvalidDirectoryError pathName: '/example') signal

The test above will raise an error in the TestRunner, however it will 
not open a debugger when you execute the test via #debug:. This is 
because InvalidDirectoryError has a #defaultAction defined which returns 
#{} rather than raising a UnhandledError exception.

So the question is, should TestRunner be changed to only catch 
UnhandleErrors, or should #debug be changed to catch all errors.

I have gone for the latter, and uploaded the fix to 
http://www.squeaksource.com/Testing in order to try it out.

Keith





		
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html



More information about the Squeak-dev mailing list