author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 10 Jul 2016 00:33:35 +0100 | |
branch | jv |
changeset 1503 | 1551e9fd9a91 |
parent 1447 | 2351db93aa5b |
child 1504 | 6bda790dc68a |
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 |
||
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:). |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
72 |
"/ 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
|
73 |
"/ 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
|
74 |
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
|
75 |
ObjectMemory flushInlineCaches. |
560 | 76 |
|
558 | 77 |
"/ here, we return a method... |
78 |
ex proceedWith:nil. |
|
79 |
]. |
|
80 |
self assert:(ex suspendedContext selector == #doesNotUnderstand:). |
|
81 |
self assert:(ex suspendedContext sender selector == #x). |
|
82 |
ex proceedWith:12345. |
|
83 |
] do:[ |
|
84 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
85 |
ObjectMemory flushInlineCaches. |
|
86 |
rslt := ClassWithSpecialLookup new x |
|
87 |
]. |
|
88 |
||
89 |
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
|
90 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
91 |
"Modified: / 11-07-2016 / 06:21:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
558 | 92 |
! |
93 |
||
94 |
testLookupObject_01c |
|
95 |
|rslt| |
|
96 |
||
97 |
"/ catch it, and proceed with a method... |
|
98 |
MessageNotUnderstood handle:[:ex | |
|
99 |
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
|
100 |
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
|
101 |
self assert:(ex suspendedContext sender sender sender selector == #x). |
558 | 102 |
"/ here, we return a method... |
103 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
104 |
] do:[ |
|
105 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
106 |
ObjectMemory flushInlineCaches. |
|
107 |
rslt := ClassWithSpecialLookup new x |
|
108 |
]. |
|
109 |
||
110 |
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
|
111 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
112 |
"Modified: / 10-07-2016 / 00:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
558 | 113 |
! |
114 |
||
115 |
testLookupObject_02 |
|
116 |
"/ check lookupObject with 2.. arguments |
|
559 | 117 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
558 | 118 |
self should:[ ClassWithSpecialLookup new x:1234 ] raise:MessageNotUnderstood. |
119 |
||
559 | 120 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
558 | 121 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2] raise:MessageNotUnderstood. |
122 |
||
559 | 123 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
124 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3] raise:MessageNotUnderstood. |
|
125 |
||
126 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
127 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4] raise:MessageNotUnderstood. |
|
128 |
||
129 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
130 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5] raise:MessageNotUnderstood. |
|
131 |
||
132 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
133 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6] 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] raise:MessageNotUnderstood. |
|
137 |
||
138 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
139 |
self should:[ ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8] raise:MessageNotUnderstood. |
|
558 | 140 |
! |
141 |
||
142 |
testLookupObject_02c |
|
143 |
|rslt| |
|
144 |
||
145 |
"/ catch it, and proceed with a method... |
|
559 | 146 |
|
147 |
"/ 1 arg... |
|
558 | 148 |
MessageNotUnderstood handle:[:ex | |
149 |
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
|
150 |
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
|
151 |
self assert:(ex suspendedContext sender sender sender selector == #x:). |
558 | 152 |
"/ here, we return a method... |
153 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
154 |
] do:[ |
|
155 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
156 |
ObjectMemory flushInlineCaches. |
|
157 |
rslt := ClassWithSpecialLookup new x:1234 |
|
158 |
]. |
|
559 | 159 |
self assert:(rslt = 98765). |
558 | 160 |
|
559 | 161 |
"/ 2 args... |
162 |
MessageNotUnderstood handle:[:ex | |
|
163 |
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
|
164 |
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
|
165 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:). |
559 | 166 |
"/ here, we return a method... |
167 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
168 |
] do:[ |
|
169 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
170 |
ObjectMemory flushInlineCaches. |
|
171 |
rslt := ClassWithSpecialLookup new a:1 b:2 |
|
172 |
]. |
|
558 | 173 |
self assert:(rslt = 98765). |
559 | 174 |
|
175 |
"/ 3 args... |
|
176 |
MessageNotUnderstood handle:[:ex | |
|
177 |
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
|
178 |
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
|
179 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:). |
559 | 180 |
"/ here, we return a method... |
181 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
182 |
] do:[ |
|
183 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
184 |
ObjectMemory flushInlineCaches. |
|
185 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 |
|
186 |
]. |
|
187 |
self assert:(rslt = 98765). |
|
188 |
||
189 |
"/ 4 args... |
|
190 |
MessageNotUnderstood handle:[:ex | |
|
191 |
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
|
192 |
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
|
193 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:). |
559 | 194 |
"/ here, we return a method... |
195 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
196 |
] do:[ |
|
197 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
198 |
ObjectMemory flushInlineCaches. |
|
199 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 |
|
200 |
]. |
|
201 |
self assert:(rslt = 98765). |
|
202 |
||
203 |
"/ 5 args... |
|
204 |
MessageNotUnderstood handle:[:ex | |
|
205 |
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
|
206 |
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
|
207 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:). |
559 | 208 |
"/ here, we return a method... |
209 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
210 |
] do:[ |
|
211 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
212 |
ObjectMemory flushInlineCaches. |
|
213 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 |
|
214 |
]. |
|
215 |
self assert:(rslt = 98765). |
|
216 |
||
217 |
"/ 6 args... |
|
218 |
MessageNotUnderstood handle:[:ex | |
|
219 |
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
|
220 |
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
|
221 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:). |
559 | 222 |
"/ here, we return a method... |
223 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
224 |
] do:[ |
|
225 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
226 |
ObjectMemory flushInlineCaches. |
|
227 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 |
|
228 |
]. |
|
229 |
self assert:(rslt = 98765). |
|
230 |
||
231 |
"/ 7 args... |
|
232 |
MessageNotUnderstood handle:[:ex | |
|
233 |
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
|
234 |
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
|
235 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:). |
559 | 236 |
"/ here, we return a method... |
237 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
238 |
] do:[ |
|
239 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
240 |
ObjectMemory flushInlineCaches. |
|
241 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 |
|
242 |
]. |
|
243 |
self assert:(rslt = 98765). |
|
244 |
||
245 |
"/ 8 args... |
|
246 |
MessageNotUnderstood handle:[:ex | |
|
247 |
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
|
248 |
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
|
249 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:). |
559 | 250 |
"/ here, we return a method... |
251 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
252 |
] do:[ |
|
253 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
254 |
ObjectMemory flushInlineCaches. |
|
255 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 |
|
256 |
]. |
|
257 |
self assert:(rslt = 98765). |
|
258 |
||
259 |
"/ 9 args... |
|
260 |
MessageNotUnderstood handle:[:ex | |
|
261 |
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
|
262 |
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
|
263 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:). |
559 | 264 |
"/ here, we return a method... |
265 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
266 |
] do:[ |
|
267 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
268 |
ObjectMemory flushInlineCaches. |
|
269 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 |
|
270 |
]. |
|
271 |
self assert:(rslt = 98765). |
|
272 |
||
273 |
"/ 10 args... |
|
274 |
MessageNotUnderstood handle:[:ex | |
|
275 |
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
|
276 |
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
|
277 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:). |
559 | 278 |
"/ here, we return a method... |
279 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
280 |
] do:[ |
|
281 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
282 |
ObjectMemory flushInlineCaches. |
|
283 |
rslt := ClassWithSpecialLookup new a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10 |
|
284 |
]. |
|
285 |
self assert:(rslt = 98765). |
|
286 |
||
287 |
"/ 11 args... |
|
288 |
MessageNotUnderstood handle:[:ex | |
|
289 |
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
|
290 |
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
|
291 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:). |
559 | 292 |
"/ here, we return a method... |
293 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
294 |
] do:[ |
|
295 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
296 |
ObjectMemory flushInlineCaches. |
|
297 |
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 |
|
298 |
]. |
|
299 |
self assert:(rslt = 98765). |
|
300 |
||
301 |
"/ 12 args... |
|
302 |
MessageNotUnderstood handle:[:ex | |
|
303 |
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
|
304 |
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
|
305 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:). |
559 | 306 |
"/ here, we return a method... |
307 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
308 |
] do:[ |
|
309 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
310 |
ObjectMemory flushInlineCaches. |
|
311 |
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 |
|
312 |
]. |
|
313 |
self assert:(rslt = 98765). |
|
314 |
||
315 |
"/ 13 args... |
|
316 |
MessageNotUnderstood handle:[:ex | |
|
317 |
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
|
318 |
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
|
319 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:). |
559 | 320 |
"/ here, we return a method... |
321 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
322 |
] do:[ |
|
323 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
324 |
ObjectMemory flushInlineCaches. |
|
325 |
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 |
|
326 |
]. |
|
327 |
self assert:(rslt = 98765). |
|
328 |
||
329 |
"/ 14 args... |
|
330 |
MessageNotUnderstood handle:[:ex | |
|
331 |
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
|
332 |
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
|
333 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:). |
559 | 334 |
"/ here, we return a method... |
335 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
336 |
] do:[ |
|
337 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
338 |
ObjectMemory flushInlineCaches. |
|
339 |
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 |
|
340 |
]. |
|
341 |
self assert:(rslt = 98765). |
|
342 |
||
343 |
"/ 15 args... |
|
344 |
MessageNotUnderstood handle:[:ex | |
|
345 |
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
|
346 |
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
|
347 |
self assert:(ex suspendedContext sender sender sender selector == #a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:). |
559 | 348 |
"/ here, we return a method... |
349 |
ex proceedWith:(self class compiledMethodAt:#returnConstant98765). |
|
350 |
] do:[ |
|
351 |
ClassWithSpecialLookup setLookupObject:BadLookupClass. |
|
352 |
ObjectMemory flushInlineCaches. |
|
353 |
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 |
|
354 |
]. |
|
355 |
self assert:(rslt = 98765). |
|
356 |
||
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
357 |
"Modified: / 10-07-2016 / 00:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
559 | 358 |
! |
359 |
||
360 |
testLookupObject_03 |
|
361 |
"/ check good lookupObject with 0.. arguments |
|
362 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
363 |
self assert:( ClassWithSpecialLookup new x ) = 12345. |
|
364 |
||
365 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
366 |
self assert:( ClassWithSpecialLookup new x:1234 ) = 12345. |
|
367 |
||
368 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
369 |
self should:( ClassWithSpecialLookup new a1:1 a2:2) = 12345. |
|
370 |
||
371 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
372 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3) = 12345. |
|
373 |
||
374 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
375 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4) = 12345. |
|
376 |
||
377 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
378 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5) = 12345. |
|
379 |
||
380 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
381 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6) = 12345. |
|
382 |
||
383 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
384 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7) = 12345. |
|
385 |
||
386 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
387 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8) = 12345. |
|
388 |
||
389 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
390 |
self should:( ClassWithSpecialLookup new a1:1 a2:2 a3:3 a4:4 a5:5 a6:6 a7:7 a8:8 a9:9) = 12345. |
|
391 |
||
392 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
393 |
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. |
|
394 |
||
395 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
396 |
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. |
|
397 |
||
398 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
399 |
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. |
|
400 |
||
401 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
402 |
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. |
|
403 |
||
404 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
405 |
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. |
|
406 |
||
407 |
ClassWithSpecialLookup setLookupObject:LookupClass. |
|
408 |
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. |
|
409 |
! ! |
|
410 |
||
411 |
!BehaviorLookupObjectTests::LookupClass class methodsFor:'lookup'! |
|
412 |
||
560 | 413 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext |
559 | 414 |
^ self compiledMethodAt:#returnConstant12345 |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
415 |
! |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
416 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
417 |
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
|
418 |
^ self compiledMethodAt:#returnConstant12345 |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
419 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
420 |
"Created: / 04-09-2013 / 19:25:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
559 | 421 |
! ! |
422 |
||
423 |
!BehaviorLookupObjectTests::LookupClass methodsFor:'trap methods'! |
|
424 |
||
425 |
returnConstant12345 |
|
426 |
^ 12345 |
|
427 |
! ! |
|
428 |
||
429 |
!BehaviorLookupObjectTests::NilReturningLookupClass class methodsFor:'lookup'! |
|
430 |
||
560 | 431 |
lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext |
559 | 432 |
^ nil |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
433 |
! |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
434 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
435 |
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
|
436 |
^ nil |
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
437 |
|
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
438 |
"Created: / 04-09-2013 / 19:26:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
558 | 439 |
! ! |
440 |
||
441 |
!BehaviorLookupObjectTests class methodsFor:'documentation'! |
|
442 |
||
443 |
version_CVS |
|
444 |
^ '$Header$' |
|
1503
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
445 |
! |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
446 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
447 |
version_HG |
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
448 |
|
1551e9fd9a91
Issue #73: Added (and fixed) BehaviorLookupObjectTests to standard test suite.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1447
diff
changeset
|
449 |
^ '$Changeset: <not expanded> $' |
558 | 450 |
! ! |
996
b2247dd458ed
class: RegressionTests::BehaviorLookupObjectTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
561
diff
changeset
|
451 |