checkin from browser
authorClaus Gittinger <cg@exept.de>
Thu, 10 Jan 2002 01:56:16 +0100
changeset 147 ad483efa672a
parent 146 b86931293eb3
child 148 7f97a9cfc234
checkin from browser
RegressionTests__ContextTest2.st
--- a/RegressionTests__ContextTest2.st	Fri Dec 21 16:43:38 2001 +0100
+++ b/RegressionTests__ContextTest2.st	Thu Jan 10 01:56:16 2002 +0100
@@ -12,6 +12,52 @@
 
 !ContextTest2 methodsFor:'tests'!
 
+downToNextSegmentThenDo:aBlock
+    self 
+        downToSegment:(Processor activeProcess numberOfStackSegments + 1)
+        thenDo:aBlock
+
+    "
+     self new testUnwind1
+    "
+!
+
+downToNextSegmentThenUnwindAndDo:aBlock
+    self 
+        downToSegment:(Processor activeProcess numberOfStackSegments + 1)
+        thenUnwindAndDo:aBlock
+
+    "
+     self new testUnwind2
+    "
+!
+
+downToSegment:nr thenDo:aBlock
+    Processor activeProcess numberOfStackSegments >= nr ifTrue:[
+        ^  aBlock value
+    ].
+    self 
+        downToSegment:(Processor activeProcess numberOfStackSegments + 1)
+        thenDo:aBlock
+
+    "
+     self new testUnwind1
+    "
+!
+
+downToSegment:nr thenUnwindAndDo:aBlock
+    Processor activeProcess numberOfStackSegments >= nr ifTrue:[
+        aBlock home unwindThenDo: aBlock
+    ].
+    self 
+        downToSegment:(Processor activeProcess numberOfStackSegments + 1)
+        thenUnwindAndDo:aBlock
+
+    "
+     self new testUnwind2
+    "
+!
+
 testProcess1
     |x set lockSet p arg|
 
@@ -78,6 +124,52 @@
     "
      self new testProcess3
     "
+!
+
+testUnwind1
+    Transcript showCR:'1'.
+    self downToNextSegmentThenDo:[Transcript showCR:'2'. ^  self ].
+    Transcript showCR:'3'.
+
+    "
+     self new testUnwind1
+    "
+!
+
+testUnwind2
+    Transcript showCR:'1'.
+    self downToNextSegmentThenUnwindAndDo:[Transcript showCR:'2'. ^  self ].
+    Transcript showCR:'3'.
+
+    "
+     self new testUnwind2
+    "
+!
+
+testUnwind3
+    <context: #return>
+
+    |foo|
+
+    Transcript showCR:'1'.
+    self downToNextSegmentThenUnwindAndDo:[Transcript showCR:'2'. foo := #foo ].
+    Transcript showCR:'3'.
+
+    "
+     self new testUnwind3
+    "
+!
+
+testUnwind4
+    |foo|
+
+    Transcript showCR:'1'.
+    self downToNextSegmentThenDo:[Transcript showCR:'2'. foo := #foo ].
+    Transcript showCR:'3'.
+
+    "
+     self new testUnwind4
+    "
 ! !
 
 !ContextTest2 class methodsFor:'documentation'!