sUnit- testing for a specific error

Stephane Ducasse ducasse at iam.unibe.ch
Sun May 11 17:34:13 UTC 2003


sure just specify the error you want.
		
	should: []
	raise: MyError
	
Stef

On Sunday, May 11, 2003, at 06:53 PM, Anthony Adachi wrote:

> 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