262 raise: anExceptionalEvent |
262 raise: anExceptionalEvent |
263 suchThat:[:ex | ex description includesString: aStringFragment] |
263 suchThat:[:ex | ex description includesString: aStringFragment] |
264 description: aString. |
264 description: aString. |
265 ! |
265 ! |
266 |
266 |
|
267 should:aBlock raise:anExceptionalEvent withExceptionDo:exCheckAction |
|
268 "during the execution of aBlock, the anExceptionalEvent should be raised, |
|
269 then exCheckAction is evaluated on the exception (which usually includes more checks). |
|
270 If not, report aString as failure-description." |
|
271 |
|
272 <resource: #skipInDebuggersWalkBack> |
|
273 |
|
274 ^ self should: aBlock |
|
275 raise: anExceptionalEvent |
|
276 suchThat:[:ex | exCheckAction value:ex. true] |
|
277 |
|
278 "should fail: |
|
279 |
|
280 self new |
|
281 should:[ 1 / Float zero] |
|
282 raise:ZeroDivide |
|
283 withExceptionDo:[:ex | |
|
284 ex description should equal:'hello world' |
|
285 ]. |
|
286 |
|
287 should fail: |
|
288 self new |
|
289 should:[ 1 / Float zero] |
|
290 raise:ZeroDivide |
|
291 withExceptionDo:[:ex | |
|
292 ex description should equal:'hello world' |
|
293 ]. |
|
294 |
|
295 should pass: |
|
296 self new |
|
297 should:[ 1 / Float zero] |
|
298 raise:ZeroDivide |
|
299 withExceptionDo:[:ex | |
|
300 ex description should equal:'hello world' |
|
301 ]. |
|
302 " |
|
303 |
|
304 "Created: / 01-07-2018 / 12:18:18 / Claus Gittinger" |
|
305 ! |
|
306 |
267 shouldnt: aBlock raise: anExceptionalEvent |
307 shouldnt: aBlock raise: anExceptionalEvent |
268 "during the execution of aBlock, the anExceptionalEvent should NOT be raised" |
308 "during the execution of aBlock, the anExceptionalEvent should NOT be raised" |
269 |
309 |
270 <resource: #skipInDebuggersWalkBack> |
310 <resource: #skipInDebuggersWalkBack> |
271 |
311 |