sUnit- testing for a specific error

Anthony Adachi adachipro at yahoo.com
Sun May 11 16:53:51 UTC 2003


Hello

How do you ensure a specific error get's thrown in an
sUnit test?

For instance...

AnErrorTest>>testForError

self should: [#(1 3 5 9)
				detect: [:n | n even].]
	raise: Error
	description: 'Should throw error if no even numbers
are detected.'.
	
...The error thrown should be:	"Error: Object is not
in the collection.". However, the code above only
checks for a generic Error.

Is it even possible for sUnit to check if a specific
error has occurred rather than just testing that any
kind of error has occurred?


Thanks,

Anthony



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the Squeak-dev mailing list