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