Issue #73: Added test for caller-specified lookup object jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 11 Jul 2016 06:30:42 +0100
branchjv
changeset 1504 6bda790dc68a
parent 1503 1551e9fd9a91
child 1505 215b4170fede
Issue #73: Added test for caller-specified lookup object
RegressionTests__BehaviorLookupObjectTests.st
--- a/RegressionTests__BehaviorLookupObjectTests.st	Sun Jul 10 00:33:35 2016 +0100
+++ b/RegressionTests__BehaviorLookupObjectTests.st	Mon Jul 11 06:30:42 2016 +0100
@@ -40,6 +40,19 @@
 
 !BehaviorLookupObjectTests methodsFor:'helpers'!
 
+callConstant98765
+    ^ self returnConstant98765
+
+    "Created: / 11-07-2016 / 06:26:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-07-2016 / 08:49:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+returnConstant12345
+    ^ 12345
+
+    "Created: / 11-07-2016 / 08:48:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 returnConstant98765
     ^ 98765
 ! !
@@ -406,6 +419,25 @@
 
     ClassWithSpecialLookup setLookupObject:LookupClass.
     self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8 a9:9 a10:10 a11:11 a12:12 a13:13 a14:14 a15:15) = 12345.
+!
+
+testLookupObject_04
+    | x |
+    self assert: self callConstant98765 == 98765.
+    [ 
+
+        (self class compiledMethodAt: #callConstant98765) setLookupObject: LookupClass.
+        ObjectMemory flushCaches.
+        ObjectMemory debugBreakPoint3.
+        x := self callConstant98765.
+        self assert: x == 12345.
+    ] ensure:[ 
+        (self class compiledMethodAt: #callConstant98765) setLookupObject: nil.
+        ObjectMemory flushCaches.
+    ].
+
+    "Created: / 11-07-2016 / 06:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-07-2016 / 08:49:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BehaviorLookupObjectTests::LookupClass class methodsFor:'lookup'!