Squeak - SUnit Testing for Errors
Posted
by Artium
on Stack Overflow
See other posts from Stack Overflow
or by Artium
Published on 2010-03-27T16:57:35Z
Indexed on
2010/03/27
17:03 UTC
Read the original article
Hit count: 304
squeak
I have been suggested to use should:rise in my test case to test for errors that a method might raise. For some reason it does not work as axpected, so I want to verify that I'm doing it right. Here is the code in the test case:
self should: [aMyClass compareTo: 'This is a string'] raise: 'invalid input'.
My compareTo/1 method looks like this:
(aMyClass isKindOf: MyClass) ifFalse: [self error: 'invalid input'.].
The test runner output is that there is "1 errors".
Thank you.
© Stack Overflow or respective owner