author | Claus Gittinger <cg@exept.de> |
Thu, 14 Apr 2016 19:08:20 +0200 | |
changeset 1393 | 50384f233a0f |
parent 996 | b2247dd458ed |
child 1447 | 2351db93aa5b |
permissions | -rw-r--r-- |
558 | 1 |
"{ Package: 'exept:regression' }" |
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 |
||
43 |
returnConstant98765 |
|
44 |
^ 98765 |
|
45 |
! ! |
|
46 |
||
47 |
!BehaviorLookupObjectTests methodsFor:'tests'! |
|
48 |
||
49 |
testLookupObject_01a |
|
50 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
51 |
self should:[ ClassWithSpecialLookup new x ] raise:MessageNotUnderstood. |
|
52 |
||
53 |
"/ at some time during the development, it crashed the second time, |
|
54 |
"/ due to a badly updated inlineCache |
|
55 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
56 |
self should:[ ClassWithSpecialLookup new x ] raise:MessageNotUnderstood. |
|
57 |
! |
|
58 |
||
59 |
testLookupObject_01b |
|
60 |
|firstException rslt| |
|
61 |
||
62 |
firstException := true. |
|
63 |
||
64 |
"/ catch it, and proceed without a method (leads to another dnu)... |
|
65 |
MessageNotUnderstood handle:[:ex | |
|
66 |
firstException ifTrue:[ |
|
67 |
firstException := false. |
|
68 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 69 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 70 |
self assert:(ex suspendedContext sender sender selector == #x). |
560 | 71 |
|
558 | 72 |
"/ here, we return a method... |
73 |
ex proceedWith:nil. |
|
74 |
]. |
|
75 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
76 |
self assert:(ex suspendedContext sender selector == #x). |
|
77 |
ex proceedWith:12345. |
|
78 |
] do:[ |
|
79 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
80 |
ObjectMemory flushInlineCaches. |
|
81 |
rslt := ClassWithSpecialLookup new x |
|
82 |
]. |
|
83 |
||
84 |
self assert:(rslt = 12345). |
|
85 |
! |
|
86 |
||
87 |
testLookupObject_01c |
|
88 |
|rslt| |
|
89 |
||
90 |
"/ catch it, and proceed with a method... |
|
91 |
MessageNotUnderstood handle:[:ex | |
|
92 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 93 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
94 |
self assert:(ex suspendedContext sender sender selector == #x). |
|
558 | 95 |
"/ here, we return a method... |
96 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
97 |
] do:[ |
|
98 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
99 |
ObjectMemory flushInlineCaches. |
|
100 |
rslt := ClassWithSpecialLookup new x |
|
101 |
]. |
|
102 |
||
103 |
self assert:(rslt = 98765). |
|
104 |
! |
|
105 |
||
106 |
testLookupObject_02 |
|
107 |
"/ check lookupObject with 2.. arguments |
|
559 | 108 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
558 | 109 |
self should:[ ClassWithSpecialLookup new x:1234 ] raise:MessageNotUnderstood. |
110 |
||
559 | 111 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
558 | 112 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2] raise:MessageNotUnderstood. |
113 |
||
559 | 114 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
115 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3] raise:MessageNotUnderstood. |
|
116 |
||
117 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
118 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4] raise:MessageNotUnderstood. |
|
119 |
||
120 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
121 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5] raise:MessageNotUnderstood. |
|
122 |
||
123 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
124 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6] raise:MessageNotUnderstood. |
|
125 |
||
126 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
127 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7] raise:MessageNotUnderstood. |
|
128 |
||
129 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
130 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8] raise:MessageNotUnderstood. |
|
558 | 131 |
! |
132 |
||
133 |
testLookupObject_02c |
|
134 |
|rslt| |
|
135 |
||
136 |
"/ catch it, and proceed with a method... |
|
559 | 137 |
|
138 |
"/ 1 arg... |
|
558 | 139 |
MessageNotUnderstood handle:[:ex | |
140 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 141 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
142 |
self assert:(ex suspendedContext sender sender selector == #x:). |
|
558 | 143 |
"/ here, we return a method... |
144 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
145 |
] do:[ |
|
146 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
147 |
ObjectMemory flushInlineCaches. |
|
148 |
rslt := ClassWithSpecialLookup new x:1234 |
|
149 |
]. |
|
559 | 150 |
self assert:(rslt = 98765). |
558 | 151 |
|
559 | 152 |
"/ 2 args... |
153 |
MessageNotUnderstood handle:[:ex | |
|
154 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 155 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
156 |
self assert:(ex suspendedContext sender sender selector == #a:b:). |
|
559 | 157 |
"/ here, we return a method... |
158 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
159 |
] do:[ |
|
160 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
161 |
ObjectMemory flushInlineCaches. |
|
162 |
rslt := ClassWithSpecialLookup new a:1 b:2 |
|
163 |
]. |
|
558 | 164 |
self assert:(rslt = 98765). |
559 | 165 |
|
166 |
"/ 3 args... |
|
167 |
MessageNotUnderstood handle:[:ex | |
|
168 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 169 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
170 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:). |
|
559 | 171 |
"/ here, we return a method... |
172 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
173 |
] do:[ |
|
174 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
175 |
ObjectMemory flushInlineCaches. |
|
176 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 |
|
177 |
]. |
|
178 |
self assert:(rslt = 98765). |
|
179 |
||
180 |
"/ 4 args... |
|
181 |
MessageNotUnderstood handle:[:ex | |
|
182 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 183 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 184 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:). |
559 | 185 |
"/ here, we return a method... |
186 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
187 |
] do:[ |
|
188 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
189 |
ObjectMemory flushInlineCaches. |
|
190 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 |
|
191 |
]. |
|
192 |
self assert:(rslt = 98765). |
|
193 |
||
194 |
"/ 5 args... |
|
195 |
MessageNotUnderstood handle:[:ex | |
|
196 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 197 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 198 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:). |
559 | 199 |
"/ here, we return a method... |
200 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
201 |
] do:[ |
|
202 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
203 |
ObjectMemory flushInlineCaches. |
|
204 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 |
|
205 |
]. |
|
206 |
self assert:(rslt = 98765). |
|
207 |
||
208 |
"/ 6 args... |
|
209 |
MessageNotUnderstood handle:[:ex | |
|
210 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 211 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 212 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:). |
559 | 213 |
"/ here, we return a method... |
214 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
215 |
] do:[ |
|
216 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
217 |
ObjectMemory flushInlineCaches. |
|
218 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 |
|
219 |
]. |
|
220 |
self assert:(rslt = 98765). |
|
221 |
||
222 |
"/ 7 args... |
|
223 |
MessageNotUnderstood handle:[:ex | |
|
224 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 225 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 226 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:). |
559 | 227 |
"/ here, we return a method... |
228 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
229 |
] do:[ |
|
230 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
231 |
ObjectMemory flushInlineCaches. |
|
232 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 |
|
233 |
]. |
|
234 |
self assert:(rslt = 98765). |
|
235 |
||
236 |
"/ 8 args... |
|
237 |
MessageNotUnderstood handle:[:ex | |
|
238 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 239 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 240 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:). |
559 | 241 |
"/ here, we return a method... |
242 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
243 |
] do:[ |
|
244 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
245 |
ObjectMemory flushInlineCaches. |
|
246 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 |
|
247 |
]. |
|
248 |
self assert:(rslt = 98765). |
|
249 |
||
250 |
"/ 9 args... |
|
251 |
MessageNotUnderstood handle:[:ex | |
|
252 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 253 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 254 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:i:). |
559 | 255 |
"/ here, we return a method... |
256 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
257 |
] do:[ |
|
258 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
259 |
ObjectMemory flushInlineCaches. |
|
260 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 |
|
261 |
]. |
|
262 |
self assert:(rslt = 98765). |
|
263 |
||
264 |
"/ 10 args... |
|
265 |
MessageNotUnderstood handle:[:ex | |
|
266 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 267 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 268 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:i:j:). |
559 | 269 |
"/ here, we return a method... |
270 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
271 |
] do:[ |
|
272 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
273 |
ObjectMemory flushInlineCaches. |
|
274 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 |
|
275 |
]. |
|
276 |
self assert:(rslt = 98765). |
|
277 |
||
278 |
"/ 11 args... |
|
279 |
MessageNotUnderstood handle:[:ex | |
|
280 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 281 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 282 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:). |
559 | 283 |
"/ here, we return a method... |
284 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
285 |
] do:[ |
|
286 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
287 |
ObjectMemory flushInlineCaches. |
|
288 |
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 |
|
289 |
]. |
|
290 |
self assert:(rslt = 98765). |
|
291 |
||
292 |
"/ 12 args... |
|
293 |
MessageNotUnderstood handle:[:ex | |
|
294 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 295 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 296 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:). |
559 | 297 |
"/ here, we return a method... |
298 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
299 |
] do:[ |
|
300 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
301 |
ObjectMemory flushInlineCaches. |
|
302 |
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 |
|
303 |
]. |
|
304 |
self assert:(rslt = 98765). |
|
305 |
||
306 |
"/ 13 args... |
|
307 |
MessageNotUnderstood handle:[:ex | |
|
308 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 309 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 310 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:). |
559 | 311 |
"/ here, we return a method... |
312 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
313 |
] do:[ |
|
314 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
315 |
ObjectMemory flushInlineCaches. |
|
316 |
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 |
|
317 |
]. |
|
318 |
self assert:(rslt = 98765). |
|
319 |
||
320 |
"/ 14 args... |
|
321 |
MessageNotUnderstood handle:[:ex | |
|
322 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 323 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 324 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:). |
559 | 325 |
"/ here, we return a method... |
326 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
327 |
] do:[ |
|
328 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
329 |
ObjectMemory flushInlineCaches. |
|
330 |
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 |
|
331 |
]. |
|
332 |
self assert:(rslt = 98765). |
|
333 |
||
334 |
"/ 15 args... |
|
335 |
MessageNotUnderstood handle:[:ex | |
|
336 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
560 | 337 |
self assert:(ex suspendedContext sender selector == #lookupMethodForSelector:directedTo:for:withArguments:from:). |
561 | 338 |
self assert:(ex suspendedContext sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:). |
559 | 339 |
"/ here, we return a method... |
340 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
341 |
] do:[ |
|
342 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
343 |
ObjectMemory flushInlineCaches. |
|
344 |
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 |
|
345 |
]. |
|
346 |
self assert:(rslt = 98765). |
|
347 |
! |
|
348 |
||
349 |
testLookupObject_02d |
|
350 |
|rslt| |
|
351 |
||
352 |
"/ lookup returns nil (for dnu); catch it, and proceed with a value... |
|
353 |
||
354 |
"/ 1 arg... |
|
355 |
MessageNotUnderstood handle:[:ex | |
|
356 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
357 |
self assert:(ex suspendedContext sender selector == #x:). |
|
358 |
"/ here, we return a value... |
|
359 |
ex proceedWith:6666. |
|
360 |
] do:[ |
|
361 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
362 |
ObjectMemory flushInlineCaches. |
|
363 |
rslt := ClassWithSpecialLookup new x:1234 |
|
364 |
]. |
|
365 |
self assert:(rslt = 6666). |
|
366 |
||
367 |
"/ 2 args... |
|
368 |
MessageNotUnderstood handle:[:ex | |
|
369 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
370 |
self assert:(ex suspendedContext sender selector == #a:b:). |
|
371 |
"/ here, we return a value... |
|
372 |
ex proceedWith:6666. |
|
373 |
] do:[ |
|
374 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
375 |
ObjectMemory flushInlineCaches. |
|
376 |
rslt := ClassWithSpecialLookup new a:1 b:2 |
|
377 |
]. |
|
378 |
self assert:(rslt = 6666). |
|
379 |
||
380 |
"/ 3 args... |
|
381 |
MessageNotUnderstood handle:[:ex | |
|
382 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
383 |
self assert:(ex suspendedContext sender selector == #a:b:c:). |
|
384 |
"/ here, we return a value... |
|
385 |
ex proceedWith:6666. |
|
386 |
] do:[ |
|
387 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
388 |
ObjectMemory flushInlineCaches. |
|
389 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 |
|
390 |
]. |
|
391 |
self assert:(rslt = 6666). |
|
392 |
||
393 |
"/ 4 args... |
|
394 |
MessageNotUnderstood handle:[:ex | |
|
395 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
396 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:). |
|
397 |
"/ here, we return a value... |
|
398 |
ex proceedWith:6666. |
|
399 |
] do:[ |
|
400 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
401 |
ObjectMemory flushInlineCaches. |
|
402 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 |
|
403 |
]. |
|
404 |
self assert:(rslt = 6666). |
|
405 |
||
406 |
"/ 5 args... |
|
407 |
MessageNotUnderstood handle:[:ex | |
|
408 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
409 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:). |
|
410 |
"/ here, we return a value... |
|
411 |
ex proceedWith:6666. |
|
412 |
] do:[ |
|
413 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
414 |
ObjectMemory flushInlineCaches. |
|
415 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 |
|
416 |
]. |
|
417 |
self assert:(rslt = 6666). |
|
418 |
||
419 |
"/ 6 args... |
|
420 |
MessageNotUnderstood handle:[:ex | |
|
421 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
422 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:). |
|
423 |
"/ here, we return a value... |
|
424 |
ex proceedWith:6666. |
|
425 |
] do:[ |
|
426 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
427 |
ObjectMemory flushInlineCaches. |
|
428 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 |
|
429 |
]. |
|
430 |
self assert:(rslt = 6666). |
|
431 |
||
432 |
"/ 7 args... |
|
433 |
MessageNotUnderstood handle:[:ex | |
|
434 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
435 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:). |
|
436 |
"/ here, we return a value... |
|
437 |
ex proceedWith:6666. |
|
438 |
] do:[ |
|
439 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
440 |
ObjectMemory flushInlineCaches. |
|
441 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 |
|
442 |
]. |
|
443 |
self assert:(rslt = 6666). |
|
444 |
||
445 |
"/ 8 args... |
|
446 |
MessageNotUnderstood handle:[:ex | |
|
447 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
448 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:). |
|
449 |
"/ here, we return a value... |
|
450 |
ex proceedWith:6666. |
|
451 |
] do:[ |
|
452 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
453 |
ObjectMemory flushInlineCaches. |
|
454 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 |
|
455 |
]. |
|
456 |
self assert:(rslt = 6666). |
|
457 |
||
458 |
"/ 9 args... |
|
459 |
MessageNotUnderstood handle:[:ex | |
|
460 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
461 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:i:). |
|
462 |
"/ here, we return a value... |
|
463 |
ex proceedWith:6666. |
|
464 |
] do:[ |
|
465 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
466 |
ObjectMemory flushInlineCaches. |
|
467 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 |
|
468 |
]. |
|
469 |
self assert:(rslt = 6666). |
|
470 |
||
471 |
"/ 10 args... |
|
472 |
MessageNotUnderstood handle:[:ex | |
|
473 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
474 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:i:j:). |
|
475 |
"/ here, we return a value... |
|
476 |
ex proceedWith:6666. |
|
477 |
] do:[ |
|
478 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
479 |
ObjectMemory flushInlineCaches. |
|
480 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 |
|
481 |
]. |
|
482 |
self assert:(rslt = 6666). |
|
483 |
||
484 |
"/ 11 args... |
|
485 |
MessageNotUnderstood handle:[:ex | |
|
486 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
487 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:i:j:k:). |
|
488 |
"/ here, we return a value... |
|
489 |
ex proceedWith:6666. |
|
490 |
] do:[ |
|
491 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
492 |
ObjectMemory flushInlineCaches. |
|
493 |
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 |
|
494 |
]. |
|
495 |
self assert:(rslt = 6666). |
|
496 |
||
497 |
"/ 12 args... |
|
498 |
MessageNotUnderstood handle:[:ex | |
|
499 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
500 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:). |
|
501 |
"/ here, we return a value... |
|
502 |
ex proceedWith:6666. |
|
503 |
] do:[ |
|
504 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
505 |
ObjectMemory flushInlineCaches. |
|
506 |
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 |
|
507 |
]. |
|
508 |
self assert:(rslt = 6666). |
|
509 |
||
510 |
"/ 13 args... |
|
511 |
MessageNotUnderstood handle:[:ex | |
|
512 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
513 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:). |
|
514 |
"/ here, we return a value... |
|
515 |
ex proceedWith:6666. |
|
516 |
] do:[ |
|
517 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
518 |
ObjectMemory flushInlineCaches. |
|
519 |
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 |
|
520 |
]. |
|
521 |
self assert:(rslt = 6666). |
|
522 |
||
523 |
"/ 14 args... |
|
524 |
MessageNotUnderstood handle:[:ex | |
|
525 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
526 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:). |
|
527 |
"/ here, we return a value... |
|
528 |
ex proceedWith:6666. |
|
529 |
] do:[ |
|
530 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
531 |
ObjectMemory flushInlineCaches. |
|
532 |
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 |
|
533 |
]. |
|
534 |
self assert:(rslt = 6666). |
|
535 |
||
536 |
"/ 15 args... |
|
537 |
MessageNotUnderstood handle:[:ex | |
|
538 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
539 |
self assert:(ex suspendedContext sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:). |
|
540 |
"/ here, we return a value... |
|
541 |
ex proceedWith:6666. |
|
542 |
] do:[ |
|
543 |
ClassWithSpecialLookup setLookupObject:NilReturningLookupClass. |
|
544 |
ObjectMemory flushInlineCaches. |
|
545 |
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 |
|
546 |
]. |
|
547 |
self assert:(rslt = 6666). |
|
548 |
! |
|
549 |
||
550 |
testLookupObject_03 |
|
551 |
"/ check good lookupObject with 0.. arguments |
|
552 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
553 |
self assert:( ClassWithSpecialLookup new x ) = 12345. |
|
554 |
||
555 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
556 |
self assert:( ClassWithSpecialLookup new x:1234 ) = 12345. |
|
557 |
||
558 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
559 |
self should:( ClassWithSpecialLookup new a1:1 a2:2) = 12345. |
|
560 |
||
561 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
562 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3) = 12345. |
|
563 |
||
564 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
565 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4) = 12345. |
|
566 |
||
567 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
568 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5) = 12345. |
|
569 |
||
570 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
571 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6) = 12345. |
|
572 |
||
573 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
574 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7) = 12345. |
|
575 |
||
576 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
577 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8) = 12345. |
|
578 |
||
579 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
580 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8 a9:9) = 12345. |
|
581 |
||
582 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
583 |
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. |
|
584 |
||
585 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
586 |
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. |
|
587 |
||
588 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
589 |
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. |
|
590 |
||
591 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
592 |
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. |
|
593 |
||
594 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
595 |
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. |
|
596 |
||
597 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
598 |
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. |
|
599 |
! ! |
|
600 |
||
601 |
!BehaviorLookupObjectTests::LookupClass class methodsFor:'lookup'! |
|
602 |
||
560 | 603 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext |
559 | 604 |
^ self compiledMethodAt:#returnConstant12345 |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
605 |
! |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
606 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
607 |
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
|
608 |
^ self compiledMethodAt:#returnConstant12345 |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
609 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
610 |
"Created: / 04-09-2013 / 19:25:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
559 | 611 |
! ! |
612 |
||
613 |
!BehaviorLookupObjectTests::LookupClass methodsFor:'trap methods'! |
|
614 |
||
615 |
returnConstant12345 |
|
616 |
^ 12345 |
|
617 |
! ! |
|
618 |
||
619 |
!BehaviorLookupObjectTests::NilReturningLookupClass class methodsFor:'lookup'! |
|
620 |
||
560 | 621 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext |
559 | 622 |
^ nil |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
623 |
! |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
624 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
625 |
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
|
626 |
^ nil |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
627 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
628 |
"Created: / 04-09-2013 / 19:26:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
558 | 629 |
! ! |
630 |
||
631 |
!BehaviorLookupObjectTests class methodsFor:'documentation'! |
|
632 |
||
633 |
version_CVS |
|
634 |
^ '$Header$' |
|
635 |
! ! |
|
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
636 |