--- a/RegressionTests__ExceptionTest.st Tue Aug 05 12:13:12 2014 +0200
+++ b/RegressionTests__ExceptionTest.st Wed Aug 20 18:09:34 2014 +0200
@@ -9,6 +9,20 @@
category:'tests-Regression'
!
+Exception subclass:#MyResumableTestError
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:ExceptionTest
+!
+
+Exception subclass:#MyTestError
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:ExceptionTest
+!
+
!ExceptionTest class methodsFor:'documentation'!
documentation
@@ -406,6 +420,42 @@
"
self new test12_reraiseOuterHandlerWithEnsure
"
+!
+
+testHandlerContext
+ "A test ensuring that when evaluating the action block the exception environment is set to the handler context."
+
+ | result |
+ result := [
+ [
+ [ MyResumableTestError signal ]
+ on: MyTestError
+ do: [ 'handler 2' ] ]
+ on: MyResumableTestError
+ do: [ MyTestError signal ] ]
+ on: MyTestError
+ do: [ 'handler 1' ].
+ self assert: 'handler 1' = result description: 'Incorrect handler'
+
+ "Created: / 20-08-2014 / 17:05:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testHandlerFromAction
+ "A test ensuring that nested exceptions work as expected."
+
+ | result |
+ result := [
+ [
+ [ self error: 'trigger error' ]
+ on: ZeroDivide
+ do: [ :ex | 'inner' ] ]
+ on: Error
+ do: [ :ex | 3 perform: ('', '/') asSymbol with: 0 ] ]
+ on: ZeroDivide
+ do: [ :ex | 'outer' ].
+ self assert: 'outer' = result description: 'Incorrect handler'
+
+ "Created: / 20-08-2014 / 17:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ExceptionTest class methodsFor:'documentation'!