RegressionTests__ExceptionTest.st
changeset 634 ae51f7778dad
parent 349 8aeec57e44db
child 641 0c1a14671aee
--- a/RegressionTests__ExceptionTest.st	Wed Aug 10 01:37:18 2011 +0200
+++ b/RegressionTests__ExceptionTest.st	Wed Aug 24 14:04:01 2011 +0200
@@ -210,6 +210,72 @@
      self run:#test6_on_do_ensure
      self new test6_on_do_ensure
     "
+!
+
+test7_error_in_unwind
+    "think about this - not sure, how to react on an error happening in the unwind..."
+
+    |zero trace|
+
+    zero := 0.
+
+    trace := OrderedCollection new.
+    Error handle:[:ex |
+        trace add:5.
+    ] do:[
+        [
+            trace add:1.
+            1 // zero.
+            trace add:2.
+        ] ensure:[
+            trace add:3.
+            1 // zero.
+            trace add:4.
+        ].
+    ].
+    self assert:(trace asArray = #(1 5 3)).
+
+    "
+     self run:#test7_error_in_unwind
+     self new test7_error_in_unwind
+    "
+
+    "Created: / 24-08-2011 / 13:55:27 / cg"
+!
+
+test8_error_in_unwind2
+    "no matter what happens in test7 - this one should work !!"
+
+    |zero trace|
+
+    zero := 0.
+
+    trace := OrderedCollection new.
+    Error handle:[:ex |
+        trace add:6.
+    ] do:[
+        Error handle:[:ex |
+            trace add:5.
+        ] do:[
+            [
+                trace add:1.
+                1 // zero.
+                trace add:2.
+            ] ensure:[
+                trace add:3.
+                1 // zero.
+                trace add:4.
+            ].
+        ].
+    ].
+    self assert:(trace asArray = #(1 5 3 6)).
+
+    "
+     self run:#test8_error_in_unwind2
+     self new test8_error_in_unwind2
+    "
+
+    "Created: / 24-08-2011 / 14:02:01 / cg"
 ! !
 
 !ExceptionTest class methodsFor:'documentation'!