author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 11 Jul 2016 06:30:42 +0100 | |
branch | jv |
changeset 1504 | 6bda790dc68a |
parent 1503 | 1551e9fd9a91 |
child 1974 | f2eaf05205d6 |
permissions | -rw-r--r-- |
1447 | 1 |
"{ Package: 'stx:goodies/regression' }" |
558 | 2 |
|
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#BehaviorLookupObjectTests |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'tests-Regression' |
|
10 |
! |
|
11 |
||
12 |
Object subclass:#BadLookupClass |
|
13 |
instanceVariableNames:'' |
|
14 |
classVariableNames:'' |
|
15 |
poolDictionaries:'' |
|
16 |
privateIn:BehaviorLookupObjectTests |
|
17 |
! |
|
18 |
||
19 |
Object subclass:#ClassWithSpecialLookup |
|
20 |
instanceVariableNames:'' |
|
21 |
classVariableNames:'' |
|
22 |
poolDictionaries:'' |
|
23 |
privateIn:BehaviorLookupObjectTests |
|
24 |
! |
|
25 |
||
26 |
Object subclass:#LookupClass |
|
27 |
instanceVariableNames:'' |
|
28 |
classVariableNames:'' |
|
29 |
poolDictionaries:'' |
|
30 |
privateIn:BehaviorLookupObjectTests |
|
31 |
! |
|
32 |
||
559 | 33 |
Object subclass:#NilReturningLookupClass |
34 |
instanceVariableNames:'' |
|
35 |
classVariableNames:'' |
|
36 |
poolDictionaries:'' |
|
37 |
privateIn:BehaviorLookupObjectTests |
|
38 |
! |
|
39 |
||
558 | 40 |
|
41 |
!BehaviorLookupObjectTests methodsFor:'helpers'! |
|
42 |
||
1504
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
43 |
callConstant98765 |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
44 |
^ self returnConstant98765 |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
45 |
|
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
46 |
"Created: / 11-07-2016 / 06:26:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
47 |
"Modified: / 11-07-2016 / 08:49:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
48 |
! |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
49 |
|
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
50 |
returnConstant12345 |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
51 |
^ 12345 |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
52 |
|
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
53 |
"Created: / 11-07-2016 / 08:48:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
54 |
! |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
55 |
|
558 | 56 |
returnConstant98765 |
57 |
^ 98765 |
|
58 |
! ! |
|
59 |
||
60 |
!BehaviorLookupObjectTests methodsFor:'tests'! |
|
61 |
||
62 |
testLookupObject_01a |
|
63 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
64 |
self should:[ ClassWithSpecialLookup new x ] raise:MessageNotUnderstood. |
|
65 |
||
66 |
"/ at some time during the development, it crashed the second time, |
|
67 |
"/ due to a badly updated inlineCache |
|
68 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
69 |
self should:[ ClassWithSpecialLookup new x ] raise:MessageNotUnderstood. |
|
70 |
! |
|
71 |
||
72 |
testLookupObject_01b |
|
73 |
|firstException rslt| |
|
74 |
||
75 |
firstException := true. |
|
76 |
||
77 |
"/ catch it, and proceed without a method (leads to another dnu)... |
|
78 |
MessageNotUnderstood handle:[:ex | |
|
79 |
firstException ifTrue:[ |
|
80 |
firstException := false. |
|
81 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
82 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
83 |
self assert:(ex suspendedContext sender sender sender selector == #x). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
84 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
85 |
"/ Remove the lookup object (the original test has been written |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
86 |
"/ for implementation that flushes the lookup object) |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
87 |
ClassWithSpecialLookup setLookupObject:nil. |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
88 |
ObjectMemory flushInlineCaches. |
560 | 89 |
|
558 | 90 |
"/ here, we return a method... |
91 |
ex proceedWith:nil. |
|
92 |
]. |
|
93 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
94 |
self assert:(ex suspendedContext sender selector == #x). |
|
95 |
ex proceedWith:12345. |
|
96 |
] do:[ |
|
97 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
98 |
ObjectMemory flushInlineCaches. |
|
99 |
rslt := ClassWithSpecialLookup new x |
|
100 |
]. |
|
101 |
||
102 |
self assert:(rslt = 12345). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
103 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
104 |
"Modified: / 11-07-2016 / 06:21:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
558 | 105 |
! |
106 |
||
107 |
testLookupObject_01c |
|
108 |
|rslt| |
|
109 |
||
110 |
"/ catch it, and proceed with a method... |
|
111 |
MessageNotUnderstood handle:[:ex | |
|
112 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
113 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
114 |
self assert:(ex suspendedContext sender sender sender selector == #x). |
558 | 115 |
"/ here, we return a method... |
116 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
117 |
] do:[ |
|
118 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
119 |
ObjectMemory flushInlineCaches. |
|
120 |
rslt := ClassWithSpecialLookup new x |
|
121 |
]. |
|
122 |
||
123 |
self assert:(rslt = 98765). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
124 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
125 |
"Modified: / 10-07-2016 / 00:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
558 | 126 |
! |
127 |
||
128 |
testLookupObject_02 |
|
129 |
"/ check lookupObject with 2.. arguments |
|
559 | 130 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
558 | 131 |
self should:[ ClassWithSpecialLookup new x:1234 ] raise:MessageNotUnderstood. |
132 |
||
559 | 133 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
558 | 134 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2] raise:MessageNotUnderstood. |
135 |
||
559 | 136 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
137 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3] raise:MessageNotUnderstood. |
|
138 |
||
139 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
140 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4] raise:MessageNotUnderstood. |
|
141 |
||
142 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
143 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5] raise:MessageNotUnderstood. |
|
144 |
||
145 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
146 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6] raise:MessageNotUnderstood. |
|
147 |
||
148 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
149 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7] raise:MessageNotUnderstood. |
|
150 |
||
151 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
152 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8] raise:MessageNotUnderstood. |
|
558 | 153 |
! |
154 |
||
155 |
testLookupObject_02c |
|
156 |
|rslt| |
|
157 |
||
158 |
"/ catch it, and proceed with a method... |
|
559 | 159 |
|
160 |
"/ 1 arg... |
|
558 | 161 |
MessageNotUnderstood handle:[:ex | |
162 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
163 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
164 |
self assert:(ex suspendedContext sender sender sender selector == #x:). |
558 | 165 |
"/ here, we return a method... |
166 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
167 |
] do:[ |
|
168 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
169 |
ObjectMemory flushInlineCaches. |
|
170 |
rslt := ClassWithSpecialLookup new x:1234 |
|
171 |
]. |
|
559 | 172 |
self assert:(rslt = 98765). |
558 | 173 |
|
559 | 174 |
"/ 2 args... |
175 |
MessageNotUnderstood handle:[:ex | |
|
176 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
177 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
178 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:). |
559 | 179 |
"/ here, we return a method... |
180 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
181 |
] do:[ |
|
182 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
183 |
ObjectMemory flushInlineCaches. |
|
184 |
rslt := ClassWithSpecialLookup new a:1 b:2 |
|
185 |
]. |
|
558 | 186 |
self assert:(rslt = 98765). |
559 | 187 |
|
188 |
"/ 3 args... |
|
189 |
MessageNotUnderstood handle:[:ex | |
|
190 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
191 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
192 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:). |
559 | 193 |
"/ here, we return a method... |
194 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
195 |
] do:[ |
|
196 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
197 |
ObjectMemory flushInlineCaches. |
|
198 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 |
|
199 |
]. |
|
200 |
self assert:(rslt = 98765). |
|
201 |
||
202 |
"/ 4 args... |
|
203 |
MessageNotUnderstood handle:[:ex | |
|
204 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
205 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
206 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:). |
559 | 207 |
"/ here, we return a method... |
208 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
209 |
] do:[ |
|
210 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
211 |
ObjectMemory flushInlineCaches. |
|
212 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 |
|
213 |
]. |
|
214 |
self assert:(rslt = 98765). |
|
215 |
||
216 |
"/ 5 args... |
|
217 |
MessageNotUnderstood handle:[:ex | |
|
218 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
219 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
220 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:). |
559 | 221 |
"/ here, we return a method... |
222 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
223 |
] do:[ |
|
224 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
225 |
ObjectMemory flushInlineCaches. |
|
226 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 |
|
227 |
]. |
|
228 |
self assert:(rslt = 98765). |
|
229 |
||
230 |
"/ 6 args... |
|
231 |
MessageNotUnderstood handle:[:ex | |
|
232 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
233 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
234 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:). |
559 | 235 |
"/ here, we return a method... |
236 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
237 |
] do:[ |
|
238 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
239 |
ObjectMemory flushInlineCaches. |
|
240 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 |
|
241 |
]. |
|
242 |
self assert:(rslt = 98765). |
|
243 |
||
244 |
"/ 7 args... |
|
245 |
MessageNotUnderstood handle:[:ex | |
|
246 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
247 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
248 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:). |
559 | 249 |
"/ here, we return a method... |
250 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
251 |
] do:[ |
|
252 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
253 |
ObjectMemory flushInlineCaches. |
|
254 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 |
|
255 |
]. |
|
256 |
self assert:(rslt = 98765). |
|
257 |
||
258 |
"/ 8 args... |
|
259 |
MessageNotUnderstood handle:[:ex | |
|
260 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
261 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
262 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:). |
559 | 263 |
"/ here, we return a method... |
264 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
265 |
] do:[ |
|
266 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
267 |
ObjectMemory flushInlineCaches. |
|
268 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 |
|
269 |
]. |
|
270 |
self assert:(rslt = 98765). |
|
271 |
||
272 |
"/ 9 args... |
|
273 |
MessageNotUnderstood handle:[:ex | |
|
274 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
275 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
276 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:). |
559 | 277 |
"/ here, we return a method... |
278 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
279 |
] do:[ |
|
280 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
281 |
ObjectMemory flushInlineCaches. |
|
282 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 |
|
283 |
]. |
|
284 |
self assert:(rslt = 98765). |
|
285 |
||
286 |
"/ 10 args... |
|
287 |
MessageNotUnderstood handle:[:ex | |
|
288 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
289 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
290 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:). |
559 | 291 |
"/ here, we return a method... |
292 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
293 |
] do:[ |
|
294 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
295 |
ObjectMemory flushInlineCaches. |
|
296 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 |
|
297 |
]. |
|
298 |
self assert:(rslt = 98765). |
|
299 |
||
300 |
"/ 11 args... |
|
301 |
MessageNotUnderstood handle:[:ex | |
|
302 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
303 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
304 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:). |
559 | 305 |
"/ here, we return a method... |
306 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
307 |
] do:[ |
|
308 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
309 |
ObjectMemory flushInlineCaches. |
|
310 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 k:11 |
|
311 |
]. |
|
312 |
self assert:(rslt = 98765). |
|
313 |
||
314 |
"/ 12 args... |
|
315 |
MessageNotUnderstood handle:[:ex | |
|
316 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
317 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
318 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:). |
559 | 319 |
"/ here, we return a method... |
320 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
321 |
] do:[ |
|
322 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
323 |
ObjectMemory flushInlineCaches. |
|
324 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 k:11 l:12 |
|
325 |
]. |
|
326 |
self assert:(rslt = 98765). |
|
327 |
||
328 |
"/ 13 args... |
|
329 |
MessageNotUnderstood handle:[:ex | |
|
330 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
331 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
332 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:). |
559 | 333 |
"/ here, we return a method... |
334 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
335 |
] do:[ |
|
336 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
337 |
ObjectMemory flushInlineCaches. |
|
338 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 k:11 l:12 m:13 |
|
339 |
]. |
|
340 |
self assert:(rslt = 98765). |
|
341 |
||
342 |
"/ 14 args... |
|
343 |
MessageNotUnderstood handle:[:ex | |
|
344 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
345 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
346 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:). |
559 | 347 |
"/ here, we return a method... |
348 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
349 |
] do:[ |
|
350 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
351 |
ObjectMemory flushInlineCaches. |
|
352 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 k:11 l:12 m:13 n:14 |
|
353 |
]. |
|
354 |
self assert:(rslt = 98765). |
|
355 |
||
356 |
"/ 15 args... |
|
357 |
MessageNotUnderstood handle:[:ex | |
|
358 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
359 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:). |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
360 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:). |
559 | 361 |
"/ here, we return a method... |
362 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
363 |
] do:[ |
|
364 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
365 |
ObjectMemory flushInlineCaches. |
|
366 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 k:11 l:12 m:13 n:14 o:15 |
|
367 |
]. |
|
368 |
self assert:(rslt = 98765). |
|
369 |
||
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
370 |
"Modified: / 10-07-2016 / 00:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
559 | 371 |
! |
372 |
||
373 |
testLookupObject_03 |
|
374 |
"/ check good lookupObject with 0.. arguments |
|
375 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
376 |
self assert:( ClassWithSpecialLookup new x ) = 12345. |
|
377 |
||
378 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
379 |
self assert:( ClassWithSpecialLookup new x:1234 ) = 12345. |
|
380 |
||
381 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
382 |
self should:( ClassWithSpecialLookup new a1:1 a2:2) = 12345. |
|
383 |
||
384 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
385 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3) = 12345. |
|
386 |
||
387 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
388 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4) = 12345. |
|
389 |
||
390 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
391 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5) = 12345. |
|
392 |
||
393 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
394 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6) = 12345. |
|
395 |
||
396 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
397 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7) = 12345. |
|
398 |
||
399 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
400 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8) = 12345. |
|
401 |
||
402 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
403 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8 a9:9) = 12345. |
|
404 |
||
405 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
406 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8 a9:9 a10:10) = 12345. |
|
407 |
||
408 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
409 |
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) = 12345. |
|
410 |
||
411 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
412 |
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) = 12345. |
|
413 |
||
414 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
415 |
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) = 12345. |
|
416 |
||
417 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
418 |
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) = 12345. |
|
419 |
||
420 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
421 |
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. |
|
1504
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
422 |
! |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
423 |
|
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
424 |
testLookupObject_04 |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
425 |
| x | |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
426 |
self assert: self callConstant98765 == 98765. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
427 |
[ |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
428 |
|
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
429 |
(self class compiledMethodAt: #callConstant98765) setLookupObject: LookupClass. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
430 |
ObjectMemory flushCaches. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
431 |
ObjectMemory debugBreakPoint3. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
432 |
x := self callConstant98765. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
433 |
self assert: x == 12345. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
434 |
] ensure:[ |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
435 |
(self class compiledMethodAt: #callConstant98765) setLookupObject: nil. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
436 |
ObjectMemory flushCaches. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
437 |
]. |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
438 |
|
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
439 |
"Created: / 11-07-2016 / 06:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6bda790dc68a
Issue #73: Added test for caller-specified lookup object
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1503
diff
changeset
|
440 |
"Modified: / 11-07-2016 / 08:49:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
559 | 441 |
! ! |
442 |
||
443 |
!BehaviorLookupObjectTests::LookupClass class methodsFor:'lookup'! |
|
444 |
||
560 | 445 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext |
559 | 446 |
^ self compiledMethodAt:#returnConstant12345 |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
447 |
! |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
448 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
449 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext ilc: ilc |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
450 |
^ self compiledMethodAt:#returnConstant12345 |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
451 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
452 |
"Created: / 04-09-2013 / 19:25:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
559 | 453 |
! ! |
454 |
||
455 |
!BehaviorLookupObjectTests::LookupClass methodsFor:'trap methods'! |
|
456 |
||
457 |
returnConstant12345 |
|
458 |
^ 12345 |
|
459 |
! ! |
|
460 |
||
461 |
!BehaviorLookupObjectTests::NilReturningLookupClass class methodsFor:'lookup'! |
|
462 |
||
560 | 463 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext |
559 | 464 |
^ nil |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
465 |
! |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
466 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
467 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext ilc: ilc |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
468 |
^ nil |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
469 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
470 |
"Created: / 04-09-2013 / 19:26:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
558 | 471 |
! ! |
472 |
||
473 |
!BehaviorLookupObjectTests class methodsFor:'documentation'! |
|
474 |
||
475 |
version_CVS |
|
476 |
^ '$Header$' |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
477 |
! |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
478 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
479 |
version_HG |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
480 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
481 |
^ '$Changeset: <not expanded> $' |
558 | 482 |
! ! |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
483 |