author | Claus Gittinger <cg@exept.de> |
Thu, 16 Nov 2006 14:58:25 +0100 | |
changeset 329 | f016dcc761f4 |
parent 328 | 6abee6197420 |
child 568 | 2d5d66196b5e |
permissions | -rw-r--r-- |
69 | 1 |
"{ Package: 'exept:regression' }" |
61 | 2 |
|
70 | 3 |
"{ NameSpace: RegressionTests }" |
4 |
||
113 | 5 |
TestCase subclass:#CompilerTest |
61 | 6 |
instanceVariableNames:'value' |
47 | 7 |
classVariableNames:'' |
8 |
poolDictionaries:'' |
|
181 | 9 |
category:'tests-Regression' |
47 | 10 |
! |
11 |
||
188 | 12 |
Object subclass:#DummyClass |
13 |
instanceVariableNames:'applicationModel service request' |
|
14 |
classVariableNames:'' |
|
15 |
poolDictionaries:'' |
|
16 |
privateIn:CompilerTest |
|
17 |
! |
|
18 |
||
47 | 19 |
|
328 | 20 |
!CompilerTest class methodsFor:'others'! |
21 |
||
22 |
||
23 |
foo:arg |
|
24 |
^ arg |
|
25 |
ifTrue:[^ 1] |
|
26 |
ifFalse:[2] |
|
27 |
! ! |
|
28 |
||
88 | 29 |
!CompilerTest class methodsFor:'tests - constants'! |
30 |
||
31 |
test_int1024 |
|
32 |
^ 1024 |
|
33 |
||
34 |
" |
|
35 |
self test_int1024 |
|
36 |
" |
|
37 |
||
38 |
! |
|
39 |
||
40 |
test_int1048576 |
|
41 |
^ 1048576 |
|
42 |
! |
|
43 |
||
44 |
test_int128 |
|
45 |
^ 128 |
|
46 |
||
47 |
" |
|
48 |
self test_int128 |
|
49 |
" |
|
50 |
! |
|
51 |
||
52 |
test_int131072 |
|
53 |
^ 131072 |
|
54 |
! |
|
55 |
||
56 |
test_int16384 |
|
57 |
^ 16384 |
|
58 |
||
59 |
" |
|
60 |
self test_int16384 |
|
61 |
" |
|
62 |
||
63 |
! |
|
64 |
||
65 |
test_int2048 |
|
66 |
^ 2048 |
|
67 |
||
68 |
" |
|
69 |
self test_int2048 |
|
70 |
" |
|
71 |
||
72 |
! |
|
73 |
||
74 |
test_int2097152 |
|
75 |
^ 2097152 |
|
76 |
! |
|
77 |
||
78 |
test_int256 |
|
79 |
^ 256 |
|
80 |
||
81 |
" |
|
82 |
self test_int256 |
|
83 |
" |
|
84 |
||
85 |
! |
|
86 |
||
87 |
test_int262144 |
|
88 |
^ 262144 |
|
89 |
! |
|
90 |
||
91 |
test_int32768 |
|
92 |
^ 32768 |
|
93 |
||
94 |
" |
|
95 |
self test_int32768 |
|
96 |
" |
|
97 |
||
98 |
! |
|
99 |
||
100 |
test_int4096 |
|
101 |
^ 4096 |
|
102 |
||
103 |
" |
|
104 |
self test_int4096 |
|
105 |
" |
|
106 |
||
107 |
! |
|
108 |
||
109 |
test_int512 |
|
110 |
^ 512 |
|
111 |
||
112 |
" |
|
113 |
self test_int512 |
|
114 |
" |
|
115 |
||
116 |
! |
|
117 |
||
118 |
test_int524288 |
|
119 |
^ 524288 |
|
120 |
! |
|
121 |
||
122 |
test_int65536 |
|
123 |
^ 65536 |
|
124 |
||
125 |
" |
|
126 |
self test_int65536 |
|
127 |
" |
|
128 |
||
129 |
! |
|
130 |
||
131 |
test_int8192 |
|
132 |
^ 8192 |
|
133 |
||
134 |
" |
|
135 |
self test_int8192 |
|
136 |
" |
|
137 |
||
138 |
! |
|
139 |
||
140 |
test_intM128 |
|
141 |
^ -128 |
|
142 |
! ! |
|
143 |
||
77 | 144 |
!CompilerTest class methodsFor:'tests argument passing'! |
145 |
||
146 |
ret0 |
|
147 |
^ 0 |
|
148 |
||
149 |
" |
|
150 |
self ret0 |
|
78 | 151 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self ret0] ] |
77 | 152 |
" |
153 |
! |
|
154 |
||
155 |
ret1 |
|
156 |
^ 1 |
|
157 |
||
158 |
" |
|
159 |
self ret1 |
|
78 | 160 |
1000000 timesRepeat:[self ret1] |
161 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self ret1] ] |
|
162 |
" |
|
163 |
! |
|
164 |
||
165 |
retArg1:arg |
|
166 |
^ arg |
|
167 |
||
168 |
" |
|
169 |
self retArg1:1 |
|
170 |
1000000 timesRepeat:[self retArg1:1] |
|
171 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retArg1:1] ] |
|
172 |
" |
|
173 |
! |
|
174 |
||
175 |
retArg2:arg1 _:arg2 |
|
176 |
^ arg2 |
|
177 |
||
178 |
" |
|
179 |
self retArg2:1 _:2 |
|
180 |
1000000 timesRepeat:[self retArg2:1 _:2] |
|
181 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retArg2:1 _:2] ] |
|
182 |
" |
|
183 |
! |
|
184 |
||
185 |
retArg3:arg1 _:arg2 _:arg3 |
|
186 |
^ arg3 |
|
187 |
||
188 |
" |
|
189 |
self retArg3:1 _:2 _:3 |
|
190 |
1000000 timesRepeat:[self retArg3:1 _:2 _:3] |
|
191 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retArg3:1 _:2 _:3] ] |
|
192 |
" |
|
193 |
! |
|
194 |
||
195 |
retArg4:arg1 _:arg2 _:arg3 _:arg4 |
|
196 |
^ arg4 |
|
197 |
||
198 |
" |
|
199 |
self retArg4:1 _:2 _:3 _:4 |
|
200 |
1000000 timesRepeat:[self retArg4:1 _:2 _:3 _:4] |
|
201 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retArg4:1 _:2 _:3 _:4] ] |
|
202 |
" |
|
203 |
! |
|
204 |
||
79 | 205 |
retArg5:arg1 _:arg2 _:arg3 _:arg4 _:arg5 |
206 |
^ arg5 |
|
207 |
||
208 |
" |
|
209 |
self retArg5:1 _:2 _:3 _:4 _:5 |
|
210 |
1000000 timesRepeat:[self retArg5:1 _:2 _:3 _:4 _:5] |
|
211 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retArg5:1 _:2 _:3 _:4 _:5] ] |
|
212 |
" |
|
213 |
! |
|
214 |
||
78 | 215 |
retLiteral1 |
216 |
^ 'hello' |
|
217 |
||
218 |
" |
|
219 |
self retLiteral1 |
|
220 |
1000000 timesRepeat:[self retLiteral1] |
|
221 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retLiteral1] ] |
|
77 | 222 |
" |
223 |
! |
|
224 |
||
225 |
retM1 |
|
226 |
^ -1 |
|
227 |
||
228 |
" |
|
229 |
self retM1 |
|
78 | 230 |
1000000 timesRepeat:[self retM1] |
231 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retM1] ] |
|
77 | 232 |
" |
233 |
! |
|
234 |
||
235 |
retSelf |
|
236 |
^ self |
|
237 |
||
238 |
" |
|
239 |
self retSelf |
|
78 | 240 |
1000000 timesRepeat:[self retSelf] |
241 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self retSelf] ] |
|
77 | 242 |
" |
243 |
! ! |
|
244 |
||
61 | 245 |
!CompilerTest methodsFor:'helpers'! |
246 |
||
81 | 247 |
size |
248 |
^ 1 |
|
249 |
! |
|
250 |
||
61 | 251 |
value:something |
252 |
value := something |
|
253 |
! ! |
|
254 |
||
328 | 255 |
!CompilerTest methodsFor:'others'! |
256 |
||
257 |
||
258 |
foo:arg |
|
259 |
^ arg |
|
260 |
ifTrue:[1] |
|
261 |
ifFalse:[2] |
|
262 |
! ! |
|
263 |
||
48 | 264 |
!CompilerTest methodsFor:'tests - booleans'! |
265 |
||
113 | 266 |
_testAnd:arg1 _:arg2 |
50 | 267 |
^ arg1 & arg2 |
268 |
||
269 |
" |
|
113 | 270 |
self new _testAnd:true _:true. |
271 |
self new _testAnd:true _:false. |
|
272 |
self new _testAnd:false _:true. |
|
273 |
self new _testAnd:false _:false. |
|
274 |
self new _testAnd:false _:nil. |
|
275 |
self new _testAnd:true _:nil. |
|
276 |
self new _testAnd:nil _:false. |
|
277 |
self new _testAnd:nil _:true. |
|
278 |
self new _testAnd:1234 _:true. |
|
279 |
self new _testAnd:1234 _:false. |
|
280 |
self new _testAnd:true _:1234. |
|
281 |
self new _testAnd:false _:1234. |
|
282 |
" |
|
283 |
! |
|
284 |
||
285 |
_testNot1:arg |
|
286 |
^ arg not |
|
287 |
||
288 |
" |
|
289 |
self new _testNot1:true. |
|
290 |
self new _testNot1:false. |
|
291 |
self new _testNot1:1234. |
|
50 | 292 |
" |
293 |
! |
|
294 |
||
113 | 295 |
_testNot2:arg1 _:arg2 |
296 |
^ arg1 not & arg2 not |
|
48 | 297 |
|
298 |
" |
|
113 | 299 |
self new _testNot2:true _:true. |
300 |
self new _testNot2:false _:true. |
|
301 |
self new _testNot2:true _:false. |
|
302 |
self new _testNot2:false _:false. |
|
303 |
||
304 |
self new _testNot2:false _:1234. |
|
305 |
self new _testNot2:true _:1234. |
|
306 |
self new _testNot2:1234 _:true. |
|
307 |
self new _testNot2:1234 _:false. |
|
308 |
self new _testNot2:1234 _:2345. |
|
309 |
" |
|
310 |
! |
|
311 |
||
312 |
_testNot3:arg1 _:arg2 |
|
313 |
^ arg1 not | arg2 not |
|
314 |
||
315 |
" |
|
316 |
self new _testNot3:true _:true. |
|
317 |
self new _testNot3:false _:true. |
|
318 |
self new _testNot3:true _:false. |
|
319 |
self new _testNot3:false _:false. |
|
320 |
||
321 |
self new _testNot3:false _:1234. |
|
322 |
self new _testNot3:true _:1234. |
|
323 |
self new _testNot3:1234 _:true. |
|
324 |
self new _testNot3:1234 _:false. |
|
325 |
self new _testNot3:1234 _:2345. |
|
48 | 326 |
" |
327 |
! |
|
328 |
||
113 | 329 |
_testOr:arg1 _:arg2 |
330 |
^ arg1 | arg2 |
|
48 | 331 |
|
332 |
" |
|
113 | 333 |
self new _testOr:true _:true. |
334 |
self new _testOr:true _:false. |
|
335 |
self new _testOr:false _:true. |
|
336 |
self new _testOr:false _:false. |
|
337 |
self new _testOr:false _:nil. |
|
338 |
self new _testOr:true _:nil. |
|
339 |
self new _testOr:nil _:false. |
|
340 |
self new _testOr:nil _:true. |
|
341 |
self new _testOr:1234 _:true. |
|
342 |
self new _testOr:1234 _:false. |
|
343 |
self new _testOr:true _:1234. |
|
344 |
self new _testOr:false _:1234. |
|
345 |
" |
|
346 |
! |
|
48 | 347 |
|
113 | 348 |
testAnd |
349 |
self assert:( ( self _testAnd:true _:true ) == true ). |
|
350 |
self assert:( ( self _testAnd:true _:false ) == false ). |
|
351 |
self assert:( ( self _testAnd:false _:true ) == false ). |
|
352 |
self assert:( ( self _testAnd:false _:false ) == false ). |
|
353 |
||
354 |
self assert:( ( self _testAnd:false _:nil ) == false ). |
|
355 |
self assert:( ( self _testAnd:true _:nil ) == nil ). |
|
356 |
self assert:( ( self _testAnd:false _:1234 ) == false ). |
|
357 |
self assert:( ( self _testAnd:true _:1234 ) == 1234 ). |
|
358 |
self should:[ self _testAnd:nil _:false ] raise:Error. |
|
359 |
self should:[ self _testAnd:nil _:true ] raise:Error. |
|
360 |
self should:[ self _testAnd:1234 _:false ] raise:Error. |
|
361 |
self should:[ self _testAnd:1234 _:true ] raise:Error. |
|
362 |
||
363 |
" |
|
364 |
self new testAnd |
|
48 | 365 |
" |
50 | 366 |
! |
367 |
||
113 | 368 |
testNot |
369 |
self assert:( ( self _testNot1:true ) == false ). |
|
370 |
self assert:( ( self _testNot1:false ) == true ). |
|
371 |
||
372 |
self should:[ self _testNot1:nil ] raise:Error. |
|
373 |
self should:[ self _testNot1:1234 ] raise:Error. |
|
374 |
||
375 |
||
376 |
self assert:( ( self _testNot2:true _:true) == false ). |
|
377 |
self assert:( ( self _testNot2:false _:true) == false ). |
|
378 |
self assert:( ( self _testNot2:true _:false) == false ). |
|
379 |
self assert:( ( self _testNot2:false _:false) == true ). |
|
380 |
||
381 |
self should:[ self _testNot2:false _:1234] raise:Error. |
|
382 |
self should:[ self _testNot2:true _:1234] raise:Error. |
|
383 |
self should:[ self _testNot2:1234 _:false] raise:Error. |
|
384 |
self should:[ self _testNot2:1234 _:true] raise:Error. |
|
385 |
self should:[ self _testNot2:1234 _:1234] raise:Error. |
|
386 |
self should:[ self _testNot2:nil _:false] raise:Error. |
|
387 |
self should:[ self _testNot2:nil _:true] raise:Error. |
|
388 |
self should:[ self _testNot2:nil _:1234] raise:Error. |
|
389 |
||
390 |
self assert:( ( self _testNot3:true _:true) == false ). |
|
391 |
self assert:( ( self _testNot3:false _:true) == true ). |
|
392 |
self assert:( ( self _testNot3:true _:false) == true ). |
|
393 |
self assert:( ( self _testNot3:false _:false) == true ). |
|
394 |
||
395 |
self should:[ self _testNot3:false _:1234] raise:Error. |
|
396 |
self should:[ self _testNot3:true _:1234] raise:Error. |
|
397 |
self should:[ self _testNot3:1234 _:false] raise:Error. |
|
398 |
self should:[ self _testNot3:1234 _:true] raise:Error. |
|
399 |
self should:[ self _testNot3:1234 _:1234] raise:Error. |
|
400 |
self should:[ self _testNot3:nil _:false] raise:Error. |
|
401 |
self should:[ self _testNot3:nil _:true] raise:Error. |
|
402 |
self should:[ self _testNot3:nil _:1234] raise:Error. |
|
50 | 403 |
|
404 |
" |
|
113 | 405 |
self new testNot |
406 |
" |
|
407 |
! |
|
408 |
||
409 |
testOr |
|
410 |
self assert:( ( self _testOr:true _:true ) == true ). |
|
411 |
self assert:( ( self _testOr:true _:false ) == true ). |
|
412 |
self assert:( ( self _testOr:false _:true ) == true ). |
|
413 |
self assert:( ( self _testOr:false _:false ) == false ). |
|
414 |
||
415 |
self assert:( ( self _testOr:false _:nil ) == nil ). |
|
416 |
self assert:( ( self _testOr:true _:nil ) == true ). |
|
417 |
self assert:( ( self _testOr:false _:1234 ) == 1234 ). |
|
418 |
self assert:( ( self _testOr:true _:1234 ) == true ). |
|
419 |
self should:[ self _testOr:nil _:false ] raise:Error. |
|
420 |
self should:[ self _testOr:nil _:true ] raise:Error. |
|
421 |
self should:[ self _testOr:1234 _:false ] raise:Error. |
|
422 |
self should:[ self _testOr:1234 _:true ] raise:Error. |
|
423 |
||
424 |
" |
|
425 |
self new testOr |
|
50 | 426 |
" |
48 | 427 |
! ! |
428 |
||
62 | 429 |
!CompilerTest methodsFor:'tests - conditions'! |
430 |
||
113 | 431 |
_testIf1:val |
62 | 432 |
|x| |
433 |
||
65 | 434 |
x := #foo. |
435 |
x := (val == #CursorRight or:[val == #CursorDown]) ifTrue:[1]. |
|
62 | 436 |
^ x |
437 |
||
438 |
" |
|
113 | 439 |
self new _testIf1:#CursorRight |
440 |
self new _testIf1:#CursorDown |
|
441 |
self new _testIf1:#Foo |
|
442 |
self new _testIf1:#CursorUp |
|
443 |
self new _testIf1:nil |
|
444 |
self new _testIf1:1 |
|
62 | 445 |
" |
63 | 446 |
! |
447 |
||
113 | 448 |
_testIf2:val |
63 | 449 |
|x| |
450 |
||
65 | 451 |
x := #foo. |
452 |
x := (val == #CursorRight or:[val == #CursorDown]) ifTrue:1. |
|
63 | 453 |
^ x |
454 |
||
455 |
" |
|
113 | 456 |
self new _testIf2:#CursorRight |
457 |
self new _testIf2:#CursorDown |
|
458 |
self new _testIf2:#Foo |
|
459 |
self new _testIf2:#CursorUp |
|
460 |
self new _testIf2:nil |
|
461 |
self new _testIf2:1 |
|
63 | 462 |
" |
65 | 463 |
! |
464 |
||
113 | 465 |
_testIf3:val |
65 | 466 |
|x| |
467 |
||
468 |
x := #foo. |
|
113 | 469 |
x := val isInteger ifTrue:1. |
65 | 470 |
^ x |
471 |
||
472 |
" |
|
113 | 473 |
self new _testIf3:#CursorRight |
474 |
self new _testIf3:#CursorDown |
|
475 |
self new _testIf3:#Foo |
|
476 |
self new _testIf3:#CursorUp |
|
477 |
self new _testIf3:nil |
|
478 |
self new _testIf3:1 |
|
65 | 479 |
" |
480 |
! |
|
481 |
||
113 | 482 |
_testIf4:val |
67 | 483 |
^ val isNil |
484 |
||
485 |
" |
|
113 | 486 |
self new _testIf4:#CursorRight |
487 |
self new _testIf4:1 |
|
488 |
self new _testIf4:nil |
|
67 | 489 |
" |
490 |
! |
|
491 |
||
113 | 492 |
_testIf4:val1 with:val2 |
493 |
^ val1 == nil and:[val2 == nil] |
|
66 | 494 |
|
495 |
" |
|
113 | 496 |
self new _testIf4:#CursorRight with:#CursorDown |
497 |
self new _testIf4:#CursorRight with:nil |
|
498 |
self new _testIf4:nil with:#CursorDown |
|
499 |
self new _testIf4:nil with:nil |
|
66 | 500 |
" |
501 |
! |
|
502 |
||
113 | 503 |
_testIf5:val |
504 |
^ val isNil ifTrue:[ |
|
505 |
1 |
|
506 |
] |
|
67 | 507 |
|
508 |
" |
|
113 | 509 |
self new _testIf5:#CursorRight |
510 |
self new _testIf5:1 |
|
511 |
self new _testIf5:nil |
|
67 | 512 |
" |
513 |
! |
|
514 |
||
113 | 515 |
_testIf5:val1 with:val2 |
516 |
^ val1 isNil and:[val2 isNil] |
|
66 | 517 |
|
518 |
" |
|
113 | 519 |
self new _testIf5:#CursorRight with:#CursorDown |
520 |
self new _testIf5:#CursorRight with:nil |
|
521 |
self new _testIf5:nil with:#CursorDown |
|
522 |
self new _testIf5:nil with:nil |
|
66 | 523 |
" |
524 |
! |
|
525 |
||
113 | 526 |
_testIf6:val |
67 | 527 |
^ val isNil ifTrue:1 |
528 |
||
529 |
" |
|
113 | 530 |
self new _testIf6:#CursorRight |
531 |
self new _testIf6:1 |
|
532 |
self new _testIf6:nil |
|
67 | 533 |
" |
534 |
! |
|
535 |
||
113 | 536 |
_testIf6b:val |
68 | 537 |
val isNil ifTrue:1 |
538 |
||
539 |
" |
|
113 | 540 |
self new _testIf6b:#CursorRight |
541 |
self new _testIf6b:1 |
|
542 |
self new _testIf6b:nil |
|
68 | 543 |
" |
544 |
! |
|
545 |
||
113 | 546 |
_testIf6c:val |
547 |
val isNil ifTrue:[ |
|
548 |
1 |
|
68 | 549 |
|
113 | 550 |
" |
551 |
self new _testIf6c:#CursorRight |
|
552 |
self new _testIf6c:1 |
|
553 |
self new _testIf6c:nil |
|
554 |
" |
|
555 |
] |
|
68 | 556 |
! |
557 |
||
113 | 558 |
_testIf6d:val |
68 | 559 |
^ val isNil ifTrue:val |
560 |
||
561 |
" |
|
113 | 562 |
self new _testIf6d:#CursorRight |
563 |
self new _testIf6d:1 |
|
564 |
self new _testIf6d:nil |
|
68 | 565 |
" |
566 |
! |
|
567 |
||
113 | 568 |
_testIf6e:val |
68 | 569 |
^ val isNil ifFalse:val |
570 |
||
571 |
" |
|
113 | 572 |
self new _testIf6e:['hello'] |
573 |
self new _testIf6e:('hello' asValue) |
|
574 |
self new _testIf6e:#CursorRight |
|
575 |
self new _testIf6e:1 |
|
576 |
self new _testIf6e:nil |
|
68 | 577 |
" |
578 |
! |
|
579 |
||
113 | 580 |
_testIf7:val |
67 | 581 |
^ val ? 1 |
582 |
||
583 |
" |
|
113 | 584 |
self new _testIf7:#CursorRight |
585 |
self new _testIf7:1 |
|
586 |
self new _testIf7:nil |
|
67 | 587 |
" |
588 |
! |
|
589 |
||
113 | 590 |
_testIfElse1:val |
65 | 591 |
|x| |
592 |
||
113 | 593 |
x := (val == #CursorRight or:[val == #CursorDown]) ifTrue:[ |
594 |
1 |
|
595 |
] ifFalse:[-1]. |
|
65 | 596 |
^ x |
597 |
||
598 |
" |
|
113 | 599 |
self new _testIfElse1:#CursorRight |
600 |
self new _testIfElse1:#CursorDown |
|
601 |
self new _testIfElse1:#Foo |
|
602 |
self new _testIfElse1:#CursorUp |
|
603 |
self new _testIfElse1:nil |
|
604 |
self new _testIfElse1:1 |
|
65 | 605 |
" |
606 |
! |
|
607 |
||
113 | 608 |
_testIfElse2:val |
65 | 609 |
|x| |
610 |
||
611 |
x := (val == #CursorRight or:[val == #CursorDown]) ifTrue:1 ifFalse:-1. |
|
612 |
^ x |
|
613 |
||
614 |
" |
|
113 | 615 |
self new _testIfElse2:#CursorRight |
616 |
self new _testIfElse2:#CursorDown |
|
617 |
self new _testIfElse2:#Foo |
|
618 |
self new _testIfElse2:#CursorUp |
|
619 |
self new _testIfElse2:nil |
|
620 |
self new _testIfElse2:1 |
|
65 | 621 |
" |
622 |
! |
|
623 |
||
113 | 624 |
_testIfElse3:val |
65 | 625 |
|x| |
626 |
||
627 |
x := (val == #CursorRight or:[val isInteger]) ifTrue:1 ifFalse:-1. |
|
628 |
^ x |
|
629 |
||
630 |
" |
|
113 | 631 |
self new _testIfElse3:#CursorRight |
632 |
self new _testIfElse3:#CursorDown |
|
633 |
self new _testIfElse3:#Foo |
|
634 |
self new _testIfElse3:#CursorUp |
|
635 |
self new _testIfElse3:nil |
|
636 |
self new _testIfElse3:1 |
|
65 | 637 |
" |
638 |
! |
|
639 |
||
113 | 640 |
_testIfElse4:val |
65 | 641 |
|x| |
642 |
||
643 |
x := #foo. |
|
113 | 644 |
x := val isInteger ifTrue:1 ifFalse:-1. |
65 | 645 |
^ x |
646 |
||
647 |
" |
|
113 | 648 |
self new _testIfElse4:#CursorRight |
649 |
self new _testIfElse4:#CursorDown |
|
650 |
self new _testIfElse4:#Foo |
|
651 |
self new _testIfElse4:#CursorUp |
|
652 |
self new _testIfElse4:nil |
|
653 |
self new _testIfElse4:1 |
|
65 | 654 |
" |
68 | 655 |
! |
656 |
||
113 | 657 |
_testIfElse5:val |
68 | 658 |
|x| |
659 |
||
660 |
x := #foo. |
|
661 |
x := val ifNil:1 ifNotNil:-1. |
|
662 |
^ x |
|
663 |
||
664 |
" |
|
113 | 665 |
self new _testIfElse5:#CursorUp |
666 |
self new _testIfElse5:nil |
|
667 |
self new _testIfElse5:1 |
|
68 | 668 |
" |
669 |
! |
|
670 |
||
113 | 671 |
_testIfElse6:val |
68 | 672 |
|x| |
673 |
||
674 |
x := #foo. |
|
675 |
x := val ifNil:[1] ifNotNil:[-1]. |
|
676 |
^ x |
|
677 |
||
678 |
" |
|
113 | 679 |
self new _testIfElse6:#CursorUp |
680 |
self new _testIfElse6:nil |
|
681 |
self new _testIfElse6:1 |
|
68 | 682 |
" |
683 |
! |
|
684 |
||
113 | 685 |
_testIfElse7:val with:val1 with:val2 |
68 | 686 |
|x| |
687 |
||
688 |
x := #foo. |
|
689 |
x := val ifNil:val1 ifNotNil:val2. |
|
690 |
^ x |
|
691 |
||
692 |
" |
|
113 | 693 |
self new _testIfElse7:#CursorUp with:1 with:2 |
694 |
self new _testIfElse7:nil with:1 with:2 |
|
695 |
self new _testIfElse7:1 with:1 with:2 |
|
696 |
" |
|
697 |
! |
|
698 |
||
699 |
testIf |
|
700 |
self assert:(self _testIf1:#CursorRight) == 1. |
|
701 |
self assert:(self _testIf1:#CursorDown) == 1. |
|
702 |
self assert:(self _testIf1:#Foo) == nil. |
|
703 |
self assert:(self _testIf1:#CursorUp) == nil. |
|
704 |
self assert:(self _testIf1:nil) == nil. |
|
705 |
self assert:(self _testIf1:1) == nil. |
|
706 |
||
707 |
self assert:(self _testIf2:#CursorRight) == 1. |
|
708 |
self assert:(self _testIf2:#CursorDown) == 1. |
|
709 |
self assert:(self _testIf2:#Foo) == nil. |
|
710 |
self assert:(self _testIf2:#CursorUp) == nil. |
|
711 |
self assert:(self _testIf2:nil) == nil. |
|
712 |
self assert:(self _testIf2:1) == nil. |
|
713 |
||
714 |
self assert:(self _testIf3:#CursorRight) == nil. |
|
715 |
self assert:(self _testIf3:#CursorDown) == nil. |
|
716 |
self assert:(self _testIf3:#Foo) == nil. |
|
717 |
self assert:(self _testIf3:#CursorUp) == nil. |
|
718 |
self assert:(self _testIf3:nil) == nil. |
|
719 |
self assert:(self _testIf3:1) == 1. |
|
720 |
||
721 |
self assert:(self _testIf4:#CursorRight) == false. |
|
722 |
self assert:(self _testIf4:nil) == true. |
|
723 |
self assert:(self _testIf4:1) == false. |
|
724 |
||
725 |
self assert:(self _testIf4:#CursorRight with:#CursorDown) == false. |
|
726 |
self assert:(self _testIf4:#CursorRight with:nil) == false. |
|
727 |
self assert:(self _testIf4:nil with:#CursorDown) == false. |
|
728 |
self assert:(self _testIf4:nil with:nil) == true. |
|
729 |
||
730 |
self assert:(self _testIf5:#CursorRight) == nil. |
|
731 |
self assert:(self _testIf5:nil) == 1. |
|
732 |
self assert:(self _testIf5:1) == nil. |
|
733 |
||
734 |
self assert:(self _testIf5:#CursorRight with:#CursorDown) == false. |
|
735 |
self assert:(self _testIf5:#CursorRight with:nil) == false. |
|
736 |
self assert:(self _testIf5:nil with:#CursorDown) == false. |
|
737 |
self assert:(self _testIf5:nil with:nil) == true. |
|
738 |
||
739 |
self assert:(self _testIf6:#CursorRight) == nil. |
|
740 |
self assert:(self _testIf6:nil) == 1. |
|
741 |
self assert:(self _testIf6:1) == nil. |
|
742 |
self assert:(self _testIf6d:#CursorRight) == nil. |
|
743 |
self assert:(self _testIf6d:nil) == nil. |
|
744 |
self assert:(self _testIf6d:1) == nil. |
|
745 |
self assert:(self _testIf6e:#CursorRight) == #CursorRight. |
|
746 |
self assert:(self _testIf6e:nil) == nil. |
|
747 |
self assert:(self _testIf6e:1) == 1. |
|
748 |
self assert:(self _testIf7:#CursorRight) == #CursorRight. |
|
749 |
self assert:(self _testIf7:nil) == 1. |
|
750 |
self assert:(self _testIf7:1) == 1. |
|
751 |
||
752 |
self assert:(self _testIfElse1:#CursorRight) == 1. |
|
753 |
self assert:(self _testIfElse1:#CursorDown) == 1. |
|
754 |
self assert:(self _testIfElse1:#Foo) == -1. |
|
755 |
self assert:(self _testIfElse1:#CursorUp) == -1. |
|
756 |
self assert:(self _testIfElse1:nil) == -1. |
|
757 |
self assert:(self _testIfElse1:1) == -1. |
|
758 |
||
759 |
self assert:(self _testIfElse2:#CursorRight) == 1. |
|
760 |
self assert:(self _testIfElse2:#CursorDown) == 1. |
|
761 |
self assert:(self _testIfElse2:#Foo) == -1. |
|
762 |
self assert:(self _testIfElse2:#CursorUp) == -1. |
|
763 |
self assert:(self _testIfElse2:nil) == -1. |
|
764 |
self assert:(self _testIfElse2:1) == -1. |
|
765 |
||
766 |
self assert:(self _testIfElse3:#CursorRight) == 1. |
|
767 |
self assert:(self _testIfElse3:#CursorDown) == -1. |
|
768 |
self assert:(self _testIfElse3:#Foo) == -1. |
|
769 |
self assert:(self _testIfElse3:#CursorUp) == -1. |
|
770 |
self assert:(self _testIfElse3:nil) == -1. |
|
771 |
self assert:(self _testIfElse3:1) == 1. |
|
772 |
||
773 |
self assert:(self _testIfElse4:#CursorRight) == -1. |
|
774 |
self assert:(self _testIfElse4:#CursorDown) == -1. |
|
775 |
self assert:(self _testIfElse4:#Foo) == -1. |
|
776 |
self assert:(self _testIfElse4:#CursorUp) == -1. |
|
777 |
self assert:(self _testIfElse4:nil) == -1. |
|
778 |
self assert:(self _testIfElse4:1) == 1. |
|
779 |
||
780 |
self assert:(self _testIfElse5:#CursorUp) == -1. |
|
781 |
self assert:(self _testIfElse5:nil) == 1. |
|
782 |
self assert:(self _testIfElse5:1) == -1. |
|
783 |
||
784 |
self assert:(self _testIfElse6:#CursorUp) == -1. |
|
785 |
self assert:(self _testIfElse6:nil) == 1. |
|
786 |
self assert:(self _testIfElse6:1) == -1. |
|
787 |
||
788 |
self assert:(self _testIfElse7:#CursorUp with:1 with:2) == 2. |
|
789 |
self assert:(self _testIfElse7:nil with:1 with:2) == 1. |
|
790 |
self assert:(self _testIfElse7:1 with:1 with:2) == 2. |
|
791 |
||
792 |
" |
|
793 |
self basicNew testIf |
|
68 | 794 |
" |
62 | 795 |
! ! |
796 |
||
47 | 797 |
!CompilerTest methodsFor:'tests - constant folding'! |
798 |
||
113 | 799 |
_testFloat_pi |
47 | 800 |
^ Float pi |
801 |
! |
|
802 |
||
113 | 803 |
_testFloat_unity |
47 | 804 |
^ Float unity |
805 |
! |
|
806 |
||
113 | 807 |
_testFloat_zero |
47 | 808 |
^ Float zero |
809 |
! |
|
810 |
||
113 | 811 |
_testSmalltalk_if_else_isSmalltalkX |
47 | 812 |
Smalltalk isSmalltalkX ifTrue:[ |
113 | 813 |
^ 'yes' |
814 |
] ifFalse:[^ 'no'] |
|
47 | 815 |
! |
816 |
||
113 | 817 |
_testSmalltalk_if_else_isVisualWorks |
47 | 818 |
Smalltalk isVisualWorks ifTrue:[ |
113 | 819 |
^ 'yes' |
820 |
] ifFalse:[^ 'no'] |
|
47 | 821 |
! |
822 |
||
113 | 823 |
_testSmalltalk_if_isSmalltalkX |
47 | 824 |
Smalltalk isSmalltalkX ifTrue:[ |
113 | 825 |
^ 'yes' |
826 |
]. |
|
827 |
^ 'no' |
|
828 |
! |
|
829 |
||
830 |
_testSmalltalk_if_isSqueak |
|
831 |
Smalltalk isSqueak ifTrue:[ |
|
832 |
^ 'yes' |
|
47 | 833 |
]. |
834 |
^ 'no' |
|
835 |
! |
|
836 |
||
113 | 837 |
_testSmalltalk_if_isVisualWorks |
47 | 838 |
Smalltalk isVisualWorks ifTrue:[ |
113 | 839 |
^ 'yes' |
47 | 840 |
]. |
841 |
^ 'no' |
|
842 |
! |
|
843 |
||
113 | 844 |
_testSmalltalk_isSmalltalkX |
47 | 845 |
^ Smalltalk isSmalltalkX |
846 |
! |
|
847 |
||
113 | 848 |
_testSmalltalk_isSqueak |
47 | 849 |
^ Smalltalk isSqueak |
850 |
! |
|
851 |
||
113 | 852 |
_testSmalltalk_isVisualAge |
47 | 853 |
^ Smalltalk isVisualAge |
854 |
! |
|
855 |
||
113 | 856 |
_testSmalltalk_isVisualWorks |
47 | 857 |
^ Smalltalk isVisualWorks |
858 |
! |
|
859 |
||
113 | 860 |
_testUnaryFolding |
861 |
self _testFloat_pi ~= (Float perform:#pi) ifTrue:[ |
|
862 |
self halt |
|
863 |
]. |
|
864 |
self _testFloat_unity ~= (Float perform:#unity) ifTrue:[ |
|
865 |
self halt |
|
866 |
]. |
|
867 |
self _testFloat_zero ~= (Float perform:#zero) ifTrue:[ |
|
868 |
self halt |
|
869 |
]. |
|
870 |
self _testSmalltalk_isSmalltalkX ~= (Smalltalk perform:#isSmalltalkX) ifTrue:[ |
|
871 |
self halt |
|
872 |
]. |
|
873 |
self _testSmalltalk_isSqueak ~= (Smalltalk perform:#isSqueak) ifTrue:[ |
|
874 |
self halt |
|
875 |
]. |
|
876 |
self _testSmalltalk_isVisualWorks ~= (Smalltalk perform:#isVisualWorks) ifTrue:[ |
|
877 |
self halt |
|
878 |
]. |
|
879 |
self _testSmalltalk_isVisualAge ~= (Smalltalk perform:#isVisualAge) ifTrue:[ |
|
880 |
self halt |
|
881 |
] |
|
47 | 882 |
|
883 |
" |
|
113 | 884 |
self basicNew _testUnaryFolding |
47 | 885 |
" |
886 |
! ! |
|
887 |
||
87 | 888 |
!CompilerTest methodsFor:'tests - inlined'! |
889 |
||
113 | 890 |
_test_even:arg |
87 | 891 |
^ arg even |
892 |
||
893 |
" |
|
113 | 894 |
self new _test_even:nil |
895 |
self new _test_even:123 |
|
896 |
self new _test_even:122 |
|
897 |
self new _test_even:(100 factorial) |
|
87 | 898 |
" |
899 |
! |
|
900 |
||
113 | 901 |
_test_isInteger:arg |
87 | 902 |
^ arg isInteger |
903 |
||
904 |
" |
|
113 | 905 |
self new _test_isInteger:nil |
906 |
self new _test_isInteger:123 |
|
907 |
self new _test_isInteger:(100 factorial) |
|
87 | 908 |
" |
909 |
! |
|
910 |
||
113 | 911 |
_test_isNotInteger:arg |
87 | 912 |
^ arg isInteger not |
913 |
||
914 |
" |
|
113 | 915 |
self new _test_isNotInteger:nil |
916 |
self new _test_isNotInteger:123 |
|
917 |
self new _test_isNotInteger:(100 factorial) |
|
87 | 918 |
" |
919 |
! |
|
920 |
||
113 | 921 |
_test_max1:arg1 _:arg2 |
87 | 922 |
^ arg1 max:arg2 |
923 |
||
924 |
" |
|
113 | 925 |
self new _test_max1:nil _:nil |
926 |
self new _test_max1:1 _:nil |
|
927 |
self new _test_max1:nil _:1 |
|
928 |
self new _test_max1:1 _:2 |
|
929 |
self new _test_max1:2 _:1 |
|
930 |
||
931 |
self new _test_max1:1.0 _:nil |
|
932 |
self new _test_max1:nil _:1.0 |
|
933 |
self new _test_max1:1.0 _:2.0 |
|
934 |
self new _test_max1:2.0 _:1.0 |
|
935 |
||
936 |
self new _test_max1:1.0 _:2 |
|
937 |
self new _test_max1:2.0 _:1 |
|
938 |
self new _test_max1:1 _:2.0 |
|
939 |
self new _test_max1:2 _:1.0 |
|
87 | 940 |
" |
941 |
! |
|
942 |
||
113 | 943 |
_test_max2:arg |
87 | 944 |
^ 1 max:arg |
945 |
||
946 |
" |
|
113 | 947 |
self new _test_max2:nil |
948 |
self new _test_max2:0 |
|
949 |
self new _test_max2:1 |
|
950 |
self new _test_max2:2 |
|
951 |
||
952 |
self new _test_max2:0.0 |
|
953 |
self new _test_max2:1.0 |
|
954 |
self new _test_max2:2.0 |
|
87 | 955 |
" |
956 |
! |
|
957 |
||
113 | 958 |
_test_max3:arg |
87 | 959 |
|var| |
960 |
||
961 |
var := Array new:10. |
|
962 |
^ 1 max:arg |
|
963 |
||
964 |
" |
|
113 | 965 |
self new _test_max3:nil |
966 |
self new _test_max3:0 |
|
967 |
self new _test_max3:1 |
|
968 |
self new _test_max3:2 |
|
969 |
||
970 |
self new _test_max3:0.0 |
|
971 |
self new _test_max3:1.0 |
|
972 |
self new _test_max3:2.0 |
|
87 | 973 |
" |
974 |
! |
|
975 |
||
113 | 976 |
_test_max4:arg |
87 | 977 |
|var| |
978 |
||
979 |
var := Array new:10. |
|
980 |
^ arg max:1 |
|
981 |
||
982 |
" |
|
113 | 983 |
self new _test_max4:nil |
984 |
self new _test_max4:0 |
|
985 |
self new _test_max4:1 |
|
986 |
self new _test_max4:2 |
|
987 |
||
988 |
self new _test_max4:0.0 |
|
989 |
self new _test_max4:1.0 |
|
990 |
self new _test_max4:2.0 |
|
87 | 991 |
" |
992 |
! |
|
993 |
||
113 | 994 |
_test_min1:arg1 _:arg2 |
87 | 995 |
^ arg1 min:arg2 |
996 |
||
997 |
" |
|
113 | 998 |
self new _test_min1:nil _:nil |
999 |
self new _test_min1:1 _:nil |
|
1000 |
self new _test_min1:nil _:1 |
|
1001 |
self new _test_min1:1 _:2 |
|
1002 |
self new _test_min1:2 _:1 |
|
1003 |
||
1004 |
self new _test_min1:1.0 _:nil |
|
1005 |
self new _test_min1:nil _:1.0 |
|
1006 |
self new _test_min1:1.0 _:2.0 |
|
1007 |
self new _test_min1:2.0 _:1.0 |
|
1008 |
||
1009 |
self new _test_min1:1.0 _:2 |
|
1010 |
self new _test_min1:2.0 _:1 |
|
1011 |
self new _test_min1:1 _:2.0 |
|
1012 |
self new _test_min1:2 _:1.0 |
|
87 | 1013 |
" |
1014 |
! |
|
1015 |
||
113 | 1016 |
_test_min2:arg |
87 | 1017 |
^ 1 min:arg |
1018 |
||
1019 |
" |
|
113 | 1020 |
self new _test_min2:nil |
1021 |
self new _test_min2:0 |
|
1022 |
self new _test_min2:1 |
|
1023 |
self new _test_min2:2 |
|
1024 |
||
1025 |
self new _test_min2:0.0 |
|
1026 |
self new _test_min2:1.0 |
|
1027 |
self new _test_min2:2.0 |
|
87 | 1028 |
" |
1029 |
! |
|
1030 |
||
113 | 1031 |
_test_min3:arg |
87 | 1032 |
|var| |
1033 |
||
1034 |
var := Array new:10. |
|
1035 |
^ 1 min:arg |
|
1036 |
||
1037 |
" |
|
113 | 1038 |
self new _test_min3:nil |
1039 |
self new _test_min3:0 |
|
1040 |
self new _test_min3:1 |
|
1041 |
self new _test_min3:2 |
|
1042 |
||
1043 |
self new _test_min3:0.0 |
|
1044 |
self new _test_min3:1.0 |
|
1045 |
self new _test_min3:2.0 |
|
87 | 1046 |
" |
1047 |
! |
|
1048 |
||
113 | 1049 |
_test_min4:arg |
87 | 1050 |
|var| |
1051 |
||
1052 |
var := Array new:10. |
|
1053 |
^ arg min:1 |
|
1054 |
||
1055 |
" |
|
113 | 1056 |
self new _test_min4:nil |
1057 |
self new _test_min4:0 |
|
1058 |
self new _test_min4:1 |
|
1059 |
self new _test_min4:2 |
|
1060 |
||
1061 |
self new _test_min4:0.0 |
|
1062 |
self new _test_min4:1.0 |
|
1063 |
self new _test_min4:2.0 |
|
87 | 1064 |
" |
1065 |
! |
|
1066 |
||
113 | 1067 |
_test_odd:arg |
87 | 1068 |
^ arg odd |
1069 |
||
1070 |
" |
|
113 | 1071 |
self new _test_odd:nil |
1072 |
self new _test_odd:123 |
|
1073 |
self new _test_odd:122 |
|
1074 |
self new _test_odd:(100 factorial) |
|
87 | 1075 |
" |
1076 |
! |
|
1077 |
||
113 | 1078 |
_test_size |
87 | 1079 |
^ value size |
1080 |
||
1081 |
" |
|
113 | 1082 |
(self new value:(Array new:2)) _test_size |
1083 |
(self new value:(OrderedCollection new:2)) _test_size |
|
1084 |
" |
|
1085 |
! ! |
|
1086 |
||
188 | 1087 |
!CompilerTest methodsFor:'tests - method calls'! |
1088 |
||
189 | 1089 |
addDumpingMethodForSelfIsLostBug |
1090 |
|code mthd| |
|
1091 |
||
1092 |
code := |
|
1093 |
'_x |
|
190 | 1094 |
"/ ObjectMemory dumpSender. |
189 | 1095 |
"/ request nextPutAll: ''a''. |
1096 |
ObjectMemory garbageCollect. |
|
1097 |
ObjectMemory dumpSender. |
|
1098 |
"/ request nextPutAll: ''b''. |
|
1099 |
'. |
|
1100 |
||
1101 |
Class withoutUpdatingChangesDo:[ |
|
1102 |
mthd := (Smalltalk at:#Compiler) |
|
1103 |
compile:code |
|
1104 |
in:DummyClass |
|
1105 |
notifying:nil |
|
1106 |
ifFail:[self error]. |
|
1107 |
]. |
|
1108 |
^ mthd |
|
1109 |
! |
|
1110 |
||
1111 |
addHaltingMethodForSelfIsLostBug |
|
1112 |
|code mthd| |
|
1113 |
||
1114 |
code := |
|
1115 |
'_x |
|
1116 |
request nextPutAll: ''a''. |
|
1117 |
self halt. |
|
1118 |
ObjectMemory garbageCollect. |
|
1119 |
self halt. |
|
1120 |
request nextPutAll: ''b''. |
|
1121 |
'. |
|
1122 |
||
1123 |
Class withoutUpdatingChangesDo:[ |
|
1124 |
mthd := (Smalltalk at:#Compiler) |
|
1125 |
compile:code |
|
1126 |
in:DummyClass |
|
1127 |
notifying:nil |
|
1128 |
ifFail:[self error]. |
|
1129 |
]. |
|
1130 |
^ mthd |
|
1131 |
! |
|
1132 |
||
188 | 1133 |
addMethodForSelfIsLostBug |
1134 |
|code mthd| |
|
1135 |
||
1136 |
code := |
|
1137 |
'_x |
|
1138 |
request nextPutAll: ''a''. |
|
1139 |
ObjectMemory garbageCollect. |
|
1140 |
request nextPutAll: ''b''. |
|
1141 |
'. |
|
1142 |
||
1143 |
Class withoutUpdatingChangesDo:[ |
|
1144 |
mthd := (Smalltalk at:#Compiler) |
|
1145 |
compile:code |
|
1146 |
in:DummyClass |
|
1147 |
notifying:nil |
|
1148 |
ifFail:[self error]. |
|
1149 |
]. |
|
1150 |
^ mthd |
|
1151 |
! |
|
1152 |
||
1153 |
removeMethodForSelfIsLostBug |
|
1154 |
Class withoutUpdatingChangesDo:[ |
|
1155 |
DummyClass removeSelector:#'_x'. |
|
1156 |
]. |
|
1157 |
! |
|
1158 |
||
1159 |
test_selfIsLost1 |
|
1160 |
|mthd rcvr retVal str| |
|
1161 |
||
1162 |
str := '' writeStream. |
|
1163 |
||
1164 |
mthd := self addMethodForSelfIsLostBug. |
|
1165 |
self removeMethodForSelfIsLostBug. |
|
1166 |
rcvr := DummyClass new. |
|
1167 |
rcvr request:str. |
|
1168 |
retVal := mthd valueWithReceiver:rcvr arguments:#(). |
|
191 | 1169 |
self assert:(retVal == rcvr). |
1170 |
self assert:(str contents = 'ab'). |
|
188 | 1171 |
|
1172 |
" |
|
1173 |
self new test_selfIsLost1 |
|
1174 |
" |
|
1175 |
! |
|
1176 |
||
1177 |
test_selfIsLost2 |
|
1178 |
|mthd rcvr retVal str| |
|
1179 |
||
1180 |
str := '' writeStream. |
|
1181 |
||
1182 |
mthd := self addMethodForSelfIsLostBug. |
|
1183 |
rcvr := DummyClass new. |
|
1184 |
rcvr request:str. |
|
1185 |
||
1186 |
retVal := rcvr perform:#'_x'. |
|
1187 |
||
1188 |
self removeMethodForSelfIsLostBug. |
|
1189 |
||
191 | 1190 |
self assert:(retVal == rcvr). |
1191 |
self assert:(str contents = 'ab'). |
|
1192 |
||
188 | 1193 |
" |
1194 |
self new test_selfIsLost2 |
|
1195 |
" |
|
1196 |
! |
|
1197 |
||
1198 |
test_selfIsLost3 |
|
1199 |
|mthd rcvr retVal| |
|
1200 |
||
1201 |
mthd := DummyClass compiledMethodAt:#'_y0'. |
|
1202 |
||
1203 |
rcvr := DummyClass new. |
|
1204 |
||
1205 |
retVal := mthd valueWithReceiver:rcvr arguments:#(). |
|
1206 |
self assert:(retVal == rcvr). |
|
1207 |
||
1208 |
" |
|
1209 |
self new test_selfIsLost3 |
|
1210 |
" |
|
1211 |
! |
|
1212 |
||
1213 |
test_selfIsLost4 |
|
1214 |
|mthd rcvr retVal| |
|
1215 |
||
1216 |
mthd := DummyClass compiledMethodAt:#'_y1:'. |
|
1217 |
||
1218 |
rcvr := DummyClass new. |
|
1219 |
||
1220 |
retVal := mthd valueWithReceiver:rcvr arguments:(Array with:rcvr). |
|
191 | 1221 |
self assert:(retVal == rcvr). |
188 | 1222 |
|
1223 |
" |
|
1224 |
self new test_selfIsLost4 |
|
1225 |
" |
|
189 | 1226 |
! |
1227 |
||
1228 |
xtest_selfIsLost5 |
|
1229 |
|mthd rcvr retVal str| |
|
1230 |
||
1231 |
str := '' writeStream. |
|
1232 |
||
1233 |
mthd := self addHaltingMethodForSelfIsLostBug. |
|
1234 |
self removeMethodForSelfIsLostBug. |
|
1235 |
rcvr := DummyClass new. |
|
1236 |
rcvr request:str. |
|
1237 |
retVal := mthd valueWithReceiver:rcvr arguments:#(). |
|
1238 |
||
1239 |
" |
|
1240 |
self new xtest_selfIsLost5 |
|
1241 |
" |
|
1242 |
! |
|
1243 |
||
1244 |
xtest_selfIsLost6 |
|
1245 |
|mthd rcvr retVal str| |
|
1246 |
||
1247 |
str := '' writeStream. |
|
1248 |
||
1249 |
mthd := self addDumpingMethodForSelfIsLostBug. |
|
1250 |
self removeMethodForSelfIsLostBug. |
|
1251 |
rcvr := DummyClass new. |
|
1252 |
rcvr request:str. |
|
1253 |
retVal := mthd valueWithReceiver:rcvr arguments:#(). |
|
1254 |
||
1255 |
" |
|
1256 |
self new xtest_selfIsLost6 |
|
1257 |
" |
|
188 | 1258 |
! ! |
1259 |
||
113 | 1260 |
!CompilerTest methodsFor:'tests - parsing'! |
1261 |
||
1262 |
testParseBadLiteral |
|
1263 |
self assert:( (self class compile:'foo ^ #( a b ( c d (' ) == #Error ) . |
|
1264 |
self assert:( (self class compile:'foo ^ #( a b ( c d ()' ) == #Error ). |
|
1265 |
self assert:( (self class compile:'foo ^ #( a b ( c d ())' ) == #Error ). |
|
1266 |
self assert:( (self class compile:'foo ^ #( a b ( c d ()))' ) ~~ #Error ). |
|
1267 |
self class removeSelector:#foo. |
|
1268 |
||
1269 |
" |
|
1270 |
self new testParseBadLiteral |
|
87 | 1271 |
" |
318 | 1272 |
! |
1273 |
||
1274 |
testParseExtendedSyntax |
|
1275 |
|compiler val| |
|
1276 |
||
1277 |
compiler := Parser new. |
|
1278 |
val := compiler evaluate:' ''12\t34'' '. |
|
1279 |
self assert:( val = '12\t34' ) . |
|
1280 |
val := compiler evaluate:' ''12\u161634'' '. |
|
1281 |
self assert:( val = '12\u161634' ) . |
|
1282 |
||
1283 |
compiler parserFlags allowExtendedSTXSyntax:true. |
|
1284 |
val := compiler evaluate:' ''12\t34'' '. |
|
1285 |
self assert:( val = ('12' , Character tab , '34' )) . |
|
1286 |
val := compiler evaluate:' ''12\u161634'' '. |
|
1287 |
self assert:( val = ('12' , (Character value:16r1616) , '34' )) . |
|
1288 |
||
1289 |
" |
|
1290 |
self new testParseExtendedSyntax |
|
1291 |
" |
|
87 | 1292 |
! ! |
1293 |
||
328 | 1294 |
!CompilerTest methodsFor:'tests - return'! |
1295 |
||
1296 |
test_bad_return2 |
|
329 | 1297 |
|w a| |
1298 |
||
1299 |
w := ParserFlags warnAboutPossibleSTCCompilationProblems. |
|
1300 |
a := ParserFlags allowPossibleSTCCompilationProblems. |
|
1301 |
||
1302 |
[ |
|
1303 |
ParserFlags warnAboutPossibleSTCCompilationProblems:true. |
|
1304 |
ParserFlags allowPossibleSTCCompilationProblems:false. |
|
1305 |
||
1306 |
self |
|
1307 |
should: |
|
1308 |
[ |
|
1309 |
Compiler |
|
1310 |
compile:' |
|
328 | 1311 |
foo:arg |
1312 |
^ arg |
|
1313 |
ifTrue:[^ 1] |
|
1314 |
ifFalse:[2] |
|
1315 |
' |
|
329 | 1316 |
forClass:self class. |
1317 |
] |
|
1318 |
raise:Parser::ParseError. |
|
1319 |
] ensure:[ |
|
1320 |
ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
|
1321 |
ParserFlags allowPossibleSTCCompilationProblems:a. |
|
1322 |
]. |
|
328 | 1323 |
|
1324 |
"Created: / 16-11-2006 / 14:08:48 / cg" |
|
1325 |
! |
|
1326 |
||
1327 |
test_bad_return3 |
|
329 | 1328 |
|w a setOfSignals| |
1329 |
||
1330 |
w := ParserFlags warnAboutPossibleSTCCompilationProblems. |
|
1331 |
a := ParserFlags allowPossibleSTCCompilationProblems. |
|
1332 |
||
1333 |
[ |
|
1334 |
ParserFlags warnAboutPossibleSTCCompilationProblems:false. |
|
1335 |
ParserFlags allowPossibleSTCCompilationProblems:true. |
|
1336 |
||
1337 |
setOfSignals := SignalSet with:(Parser::ParseError) with:(Parser::ParseWarning). |
|
1338 |
self |
|
1339 |
shouldnt: |
|
1340 |
[ |
|
1341 |
Compiler |
|
1342 |
compile:' |
|
328 | 1343 |
foo:arg |
1344 |
^ arg |
|
1345 |
ifTrue:[^ 1] |
|
1346 |
ifFalse:[2] |
|
1347 |
' |
|
329 | 1348 |
forClass:self class. |
1349 |
] |
|
1350 |
raise:setOfSignals. |
|
1351 |
] ensure:[ |
|
1352 |
ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
|
1353 |
ParserFlags allowPossibleSTCCompilationProblems:a. |
|
1354 |
] |
|
328 | 1355 |
|
1356 |
"Created: / 16-11-2006 / 14:33:29 / cg" |
|
1357 |
! |
|
1358 |
||
1359 |
test_good_return1 |
|
1360 |
|setOfPossibleExceptions| |
|
1361 |
||
1362 |
setOfPossibleExceptions := SignalSet with:(Parser::ParseWarning) with:(Parser::ParseError). |
|
1363 |
self |
|
1364 |
shouldnt: |
|
1365 |
[ |
|
1366 |
Compiler |
|
1367 |
compile:' |
|
1368 |
foo:arg |
|
1369 |
arg |
|
1370 |
ifTrue:[^ 1] |
|
1371 |
ifFalse:[^ 2] |
|
1372 |
' |
|
1373 |
forClass:self class. |
|
1374 |
] |
|
1375 |
raise:setOfPossibleExceptions. |
|
1376 |
||
1377 |
"Created: / 16-11-2006 / 14:16:53 / cg" |
|
1378 |
! |
|
1379 |
||
1380 |
test_good_return2 |
|
1381 |
|setOfPossibleExceptions| |
|
1382 |
||
1383 |
setOfPossibleExceptions := SignalSet with:(Parser::ParseWarning) with:(Parser::ParseError). |
|
1384 |
self |
|
1385 |
shouldnt: |
|
1386 |
[ |
|
1387 |
Compiler |
|
1388 |
compile:' |
|
1389 |
foo:arg |
|
1390 |
^ arg |
|
1391 |
ifTrue:[1] |
|
1392 |
ifFalse:[2] |
|
1393 |
' |
|
1394 |
forClass:self class. |
|
1395 |
] |
|
1396 |
raise:setOfPossibleExceptions. |
|
1397 |
||
1398 |
"Created: / 16-11-2006 / 14:41:45 / cg" |
|
1399 |
! ! |
|
1400 |
||
84 | 1401 |
!CompilerTest methodsFor:'tests - sends'! |
1402 |
||
1403 |
m1 |
|
1404 |
^ 123 |
|
1405 |
! |
|
1406 |
||
85 | 1407 |
m10 |
1408 |
^ self m9 |
|
1409 |
||
1410 |
" |
|
1411 |
self new m10 |
|
1412 |
" |
|
1413 |
! |
|
1414 |
||
1415 |
m11 |
|
1416 |
^ self m10 |
|
1417 |
||
1418 |
" |
|
1419 |
self new m11 |
|
1420 |
" |
|
1421 |
! |
|
1422 |
||
1423 |
m12 |
|
1424 |
^ self m11 |
|
1425 |
||
1426 |
" |
|
1427 |
self new m12 |
|
1428 |
" |
|
1429 |
! |
|
1430 |
||
1431 |
m13 |
|
1432 |
^ self m12 |
|
1433 |
||
1434 |
" |
|
1435 |
self new m13 |
|
1436 |
" |
|
1437 |
! |
|
1438 |
||
1439 |
m14 |
|
1440 |
^ self m13 |
|
1441 |
||
1442 |
" |
|
1443 |
self new m14 |
|
1444 |
" |
|
1445 |
! |
|
1446 |
||
1447 |
m15 |
|
1448 |
^ self m14 |
|
1449 |
||
1450 |
" |
|
1451 |
self new m15 |
|
1452 |
" |
|
1453 |
! |
|
1454 |
||
1455 |
m16 |
|
1456 |
^ self m15 |
|
1457 |
||
1458 |
" |
|
1459 |
self new m16 |
|
1460 |
" |
|
1461 |
! |
|
1462 |
||
84 | 1463 |
m2 |
1464 |
^ self m1 |
|
1465 |
! |
|
1466 |
||
1467 |
m3 |
|
1468 |
^ self m2 |
|
1469 |
! |
|
1470 |
||
1471 |
m4 |
|
1472 |
^ self m3 |
|
1473 |
! |
|
1474 |
||
1475 |
m5 |
|
1476 |
^ self m4 |
|
1477 |
! |
|
1478 |
||
1479 |
m6 |
|
1480 |
^ self m5 |
|
1481 |
! |
|
1482 |
||
1483 |
m7 |
|
1484 |
^ self m6 |
|
1485 |
||
1486 |
" |
|
1487 |
self new m7 |
|
1488 |
" |
|
85 | 1489 |
! |
1490 |
||
1491 |
m8 |
|
1492 |
^ self m7 |
|
1493 |
||
1494 |
" |
|
1495 |
self new m8 |
|
1496 |
" |
|
1497 |
! |
|
1498 |
||
1499 |
m9 |
|
1500 |
^ self m8 |
|
1501 |
||
1502 |
" |
|
1503 |
self new m9 |
|
1504 |
" |
|
84 | 1505 |
! ! |
1506 |
||
81 | 1507 |
!CompilerTest methodsFor:'tests context setup'! |
1508 |
||
113 | 1509 |
_testContextA |
1510 |
ObjectMemory dumpObject:thisContext |
|
1511 |
||
1512 |
" |
|
1513 |
self new _testContextA |
|
1514 |
" |
|
1515 |
! |
|
1516 |
||
1517 |
_testContextB |
|
1518 |
ObjectMemory dumpObject:thisContext sender |
|
1519 |
||
1520 |
" |
|
1521 |
self new _testContextB |
|
1522 |
" |
|
1523 |
! |
|
1524 |
||
1525 |
_testContextC |
|
1526 |
thisContext fullPrintAll |
|
1527 |
||
1528 |
" |
|
1529 |
self new _testContextC |
|
1530 |
" |
|
1531 |
! |
|
1532 |
||
1533 |
_testContextD |
|
1534 |
self _testContextB |
|
1535 |
||
1536 |
" |
|
1537 |
self new _testContextD |
|
1538 |
" |
|
1539 |
! |
|
1540 |
||
1541 |
_testContextE |
|
1542 |
^ thisContext sender |
|
1543 |
||
1544 |
" |
|
1545 |
self new _testContextE |
|
1546 |
" |
|
1547 |
! |
|
1548 |
||
1549 |
_testContextF |
|
1550 |
^ self _testContextE |
|
1551 |
||
1552 |
" |
|
1553 |
self new _testContextF |
|
1554 |
" |
|
1555 |
! |
|
1556 |
||
1557 |
_testSend0 |
|
1558 |
^ 9999 |
|
1559 |
! |
|
1560 |
||
1561 |
_testSend0B:arg |
|
1562 |
^ arg |
|
1563 |
! |
|
1564 |
||
1565 |
_testSend1 |
|
1566 |
^ self _testSend0 |
|
1567 |
||
1568 |
" |
|
1569 |
self new testSend1 |
|
1570 |
" |
|
1571 |
! |
|
1572 |
||
1573 |
_testSend1B |
|
1574 |
^ self _testSend0B:1234 |
|
1575 |
||
1576 |
" |
|
1577 |
self new testSend1B |
|
1578 |
" |
|
1579 |
! |
|
1580 |
||
1581 |
_testSend1C:arg |
|
1582 |
^ self _testSend0B:arg |
|
1583 |
||
1584 |
" |
|
1585 |
self new testSend1C:9998 |
|
1586 |
" |
|
1587 |
! |
|
1588 |
||
1589 |
_testSend2 |
|
1590 |
self _testContextB |
|
1591 |
||
1592 |
" |
|
1593 |
self new testSend2 |
|
1594 |
" |
|
1595 |
! |
|
1596 |
||
1597 |
_testSend3 |
|
1598 |
self _testContextC |
|
1599 |
||
1600 |
" |
|
1601 |
self new testSend3 |
|
1602 |
" |
|
1603 |
! |
|
1604 |
||
81 | 1605 |
retArgWithFrameA:arg |
1606 |
|a b c| |
|
1607 |
||
1608 |
a := 0. |
|
1609 |
b := 1. |
|
1610 |
c := 2. |
|
1611 |
^ arg |
|
1612 |
||
1613 |
" |
|
1614 |
self new retArgWithFrameA:999 |
|
1615 |
" |
|
1616 |
! |
|
1617 |
||
82 | 1618 |
retArgWithFrameB:arg |
1619 |
|a b c| |
|
1620 |
||
1621 |
a := 0. |
|
1622 |
b := 1. |
|
1623 |
c := 2. |
|
1624 |
self retSelf. |
|
1625 |
||
1626 |
^ arg |
|
1627 |
||
1628 |
" |
|
1629 |
self new retArgWithFrameB:9999 |
|
1630 |
" |
|
1631 |
! |
|
1632 |
||
81 | 1633 |
retLocal |
1634 |
|a| |
|
1635 |
||
1636 |
a := 0. |
|
1637 |
^ a |
|
79 | 1638 |
|
81 | 1639 |
" |
1640 |
self new retLocal |
|
1641 |
1000000 timesRepeat:[self new retInstVar] |
|
1642 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new retInstVar] ] |
|
1643 |
" |
|
1644 |
||
1645 |
" |
|
1646 |
|i| |
|
1647 |
||
1648 |
i := self new. |
|
1649 |
i instVarAt:1 put:12345. |
|
1650 |
i retInstVar |
|
1651 |
" |
|
1652 |
||
1653 |
" |
|
1654 |
|i| |
|
1655 |
i := self new. |
|
1656 |
i instVarAt:1 put:12345. |
|
1657 |
1000000 timesRepeat:[i retInstVar] |
|
1658 |
" |
|
79 | 1659 |
|
1660 |
" |
|
81 | 1661 |
|i| |
1662 |
i := self new. |
|
1663 |
i instVarAt:1 put:12345. |
|
1664 |
Time millisecondsToRun:[ 1000000 timesRepeat:[i retInstVar] ] |
|
1665 |
" |
|
1666 |
||
1667 |
||
1668 |
! |
|
1669 |
||
1670 |
retLocalB |
|
1671 |
|a b c| |
|
1672 |
||
1673 |
a := 0. |
|
1674 |
b := 1. |
|
1675 |
c := 2. |
|
1676 |
^ a |
|
1677 |
||
1678 |
" |
|
1679 |
self new retLocalB |
|
86 | 1680 |
1000000 timesRepeat:[self new retLocalB] |
81 | 1681 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new retInstVar] ] |
86 | 1682 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new retLocalB] ] |
81 | 1683 |
" |
1684 |
||
1685 |
" |
|
1686 |
|i| |
|
1687 |
||
1688 |
i := self new. |
|
1689 |
i instVarAt:1 put:12345. |
|
1690 |
i retInstVar |
|
1691 |
" |
|
1692 |
||
1693 |
" |
|
1694 |
|i| |
|
1695 |
i := self new. |
|
1696 |
i instVarAt:1 put:12345. |
|
1697 |
1000000 timesRepeat:[i retInstVar] |
|
1698 |
" |
|
1699 |
||
1700 |
" |
|
1701 |
|i| |
|
1702 |
i := self new. |
|
1703 |
i instVarAt:1 put:12345. |
|
1704 |
Time millisecondsToRun:[ 1000000 timesRepeat:[i retInstVar] ] |
|
1705 |
" |
|
1706 |
||
1707 |
||
1708 |
! |
|
1709 |
||
1710 |
retLocalC |
|
1711 |
|a b c| |
|
1712 |
||
1713 |
a := 0. |
|
1714 |
b := 1. |
|
1715 |
c := 2. |
|
1716 |
^ b |
|
1717 |
||
1718 |
" |
|
1719 |
self new retLocalC |
|
79 | 1720 |
1000000 timesRepeat:[self new retInstVar] |
1721 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new retInstVar] ] |
|
1722 |
" |
|
1723 |
||
1724 |
" |
|
1725 |
|i| |
|
1726 |
||
1727 |
i := self new. |
|
1728 |
i instVarAt:1 put:12345. |
|
1729 |
i retInstVar |
|
1730 |
" |
|
1731 |
||
1732 |
" |
|
1733 |
|i| |
|
1734 |
i := self new. |
|
1735 |
i instVarAt:1 put:12345. |
|
1736 |
1000000 timesRepeat:[i retInstVar] |
|
1737 |
" |
|
1738 |
||
1739 |
" |
|
1740 |
|i| |
|
1741 |
i := self new. |
|
1742 |
i instVarAt:1 put:12345. |
|
1743 |
Time millisecondsToRun:[ 1000000 timesRepeat:[i retInstVar] ] |
|
1744 |
" |
|
1745 |
||
1746 |
||
1747 |
! |
|
1748 |
||
81 | 1749 |
retLocalD |
1750 |
|a b c| |
|
1751 |
||
1752 |
a := 0. |
|
1753 |
b := 1. |
|
1754 |
c := 2. |
|
1755 |
^ c |
|
1756 |
||
1757 |
" |
|
1758 |
self new retLocalD |
|
1759 |
1000000 timesRepeat:[self new retInstVar] |
|
1760 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new retInstVar] ] |
|
1761 |
" |
|
1762 |
||
1763 |
" |
|
1764 |
|i| |
|
1765 |
||
1766 |
i := self new. |
|
1767 |
i instVarAt:1 put:12345. |
|
1768 |
i retInstVar |
|
1769 |
" |
|
1770 |
||
1771 |
" |
|
1772 |
|i| |
|
1773 |
i := self new. |
|
1774 |
i instVarAt:1 put:12345. |
|
1775 |
1000000 timesRepeat:[i retInstVar] |
|
1776 |
" |
|
1777 |
||
1778 |
" |
|
1779 |
|i| |
|
1780 |
i := self new. |
|
1781 |
i instVarAt:1 put:12345. |
|
1782 |
Time millisecondsToRun:[ 1000000 timesRepeat:[i retInstVar] ] |
|
1783 |
" |
|
1784 |
||
1785 |
||
1786 |
! |
|
1787 |
||
1788 |
retLocalE |
|
1789 |
|a b c| |
|
80 | 1790 |
|
1791 |
a := 0. |
|
81 | 1792 |
b := 1. |
1793 |
c := 2. |
|
1794 |
^ self |
|
1795 |
||
1796 |
" |
|
1797 |
self new retLocalE |
|
1798 |
1000000 timesRepeat:[self new retInstVar] |
|
1799 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new retInstVar] ] |
|
1800 |
" |
|
1801 |
||
1802 |
" |
|
1803 |
|i| |
|
1804 |
||
1805 |
i := self new. |
|
1806 |
i instVarAt:1 put:12345. |
|
1807 |
i retInstVar |
|
1808 |
" |
|
1809 |
||
1810 |
" |
|
1811 |
|i| |
|
1812 |
i := self new. |
|
1813 |
i instVarAt:1 put:12345. |
|
1814 |
1000000 timesRepeat:[i retInstVar] |
|
1815 |
" |
|
1816 |
||
1817 |
" |
|
1818 |
|i| |
|
1819 |
i := self new. |
|
1820 |
i instVarAt:1 put:12345. |
|
1821 |
Time millisecondsToRun:[ 1000000 timesRepeat:[i retInstVar] ] |
|
1822 |
" |
|
1823 |
||
1824 |
||
1825 |
! |
|
1826 |
||
82 | 1827 |
retLocalF |
1828 |
|a b c| |
|
1829 |
||
1830 |
a := 0. |
|
1831 |
b := 1. |
|
1832 |
c := 2. |
|
1833 |
self retSelf. |
|
1834 |
||
1835 |
^ a |
|
1836 |
||
1837 |
" |
|
1838 |
self new retLocalF |
|
1839 |
" |
|
1840 |
||
1841 |
||
1842 |
||
1843 |
! |
|
1844 |
||
1845 |
retLocalG |
|
1846 |
|a b c| |
|
1847 |
||
1848 |
a := 0. |
|
1849 |
b := 1. |
|
1850 |
c := 2. |
|
1851 |
self retSelf. |
|
1852 |
||
1853 |
^ b |
|
1854 |
||
1855 |
" |
|
1856 |
self new retLocalG |
|
1857 |
" |
|
1858 |
||
1859 |
||
1860 |
||
1861 |
! |
|
1862 |
||
1863 |
retLocalH |
|
1864 |
|a b c| |
|
1865 |
||
1866 |
a := 0. |
|
1867 |
b := 1. |
|
1868 |
c := 2. |
|
1869 |
self retSelf. |
|
1870 |
||
1871 |
^ c |
|
1872 |
||
1873 |
" |
|
1874 |
self new retLocalH |
|
1875 |
" |
|
1876 |
||
1877 |
||
1878 |
||
1879 |
! |
|
1880 |
||
1881 |
retSelf |
|
1882 |
||
1883 |
||
81 | 1884 |
! ! |
1885 |
||
1886 |
!CompilerTest methodsFor:'tests entry'! |
|
1887 |
||
1888 |
ilcMissCheck |
|
1889 |
||
1890 |
||
1891 |
||
1892 |
" |
|
1893 |
(Array with:self new with:nil) do:[:el | el size printCR.]. |
|
1894 |
" |
|
1895 |
||
1896 |
||
1897 |
||
1898 |
! ! |
|
1899 |
||
1900 |
!CompilerTest methodsFor:'tests instvar access'! |
|
1901 |
||
1902 |
retInstVar |
|
1903 |
^ value |
|
1904 |
||
1905 |
" |
|
1906 |
self new retInstVar |
|
80 | 1907 |
1000000 timesRepeat:[self new retInstVar] |
1908 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new retInstVar] ] |
|
79 | 1909 |
" |
1910 |
||
1911 |
" |
|
1912 |
|i| |
|
1913 |
||
1914 |
i := self new. |
|
1915 |
i instVarAt:1 put:12345. |
|
80 | 1916 |
i retInstVar |
1917 |
" |
|
1918 |
||
1919 |
" |
|
1920 |
|i| |
|
1921 |
i := self new. |
|
1922 |
i instVarAt:1 put:12345. |
|
1923 |
1000000 timesRepeat:[i retInstVar] |
|
1924 |
" |
|
1925 |
||
1926 |
" |
|
1927 |
|i| |
|
1928 |
i := self new. |
|
1929 |
i instVarAt:1 put:12345. |
|
1930 |
Time millisecondsToRun:[ 1000000 timesRepeat:[i retInstVar] ] |
|
1931 |
" |
|
1932 |
||
1933 |
||
1934 |
! |
|
1935 |
||
1936 |
setInstVarA |
|
1937 |
value := 123 |
|
1938 |
||
1939 |
" |
|
1940 |
self new setInstVarA; instVarAt:1 |
|
1941 |
1000000 timesRepeat:[self new setInstVarA] |
|
1942 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new setInstVarA] ] |
|
1943 |
" |
|
1944 |
||
1945 |
" |
|
1946 |
|i| |
|
1947 |
||
1948 |
i := self new. |
|
1949 |
i instVarAt:1 put:12345. |
|
1950 |
i setInstVarA. |
|
79 | 1951 |
i instVarAt:1 |
1952 |
" |
|
1953 |
||
1954 |
||
1955 |
||
80 | 1956 |
! |
1957 |
||
1958 |
setInstVarB |
|
1959 |
value := 'hello' |
|
1960 |
||
1961 |
" |
|
1962 |
self new setInstVarB; instVarAt:1 |
|
1963 |
1000000 timesRepeat:[self new setInstVarB] |
|
1964 |
Time millisecondsToRun:[ 1000000 timesRepeat:[self new setInstVarB] ] |
|
1965 |
" |
|
1966 |
||
1967 |
" |
|
1968 |
|i| |
|
1969 |
||
1970 |
i := self new. |
|
1971 |
i instVarAt:1 put:12345. |
|
1972 |
i setInstVarB. |
|
1973 |
i instVarAt:1 |
|
1974 |
" |
|
1975 |
||
1976 |
||
1977 |
||
79 | 1978 |
! ! |
1979 |
||
213
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1980 |
!CompilerTest methodsFor:'tests-literals'! |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1981 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1982 |
compile:someCode |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1983 |
|m| |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1984 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1985 |
m := Compiler |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1986 |
compile:someCode |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1987 |
forClass:nil |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1988 |
install:false. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1989 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1990 |
self assert:(m notNil and:[m ~~ #Error]). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1991 |
^ m |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1992 |
! |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1993 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1994 |
testLiterals |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1995 |
" |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1996 |
self new testLiterals |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1997 |
" |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1998 |
|m| |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
1999 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2000 |
"/ literals must be present, even if code has been optimized away |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2001 |
"/ (otherwise, searches do not work correctly) |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2002 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2003 |
m := self compile:'foo:arg |v| ^ (v ~~ 0) not'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2004 |
self assert:(m literals includesIdentical:#'~~'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2005 |
self assert:(m literals includesIdentical:#'not'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2006 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2007 |
m := self compile:'foo:arg |v| ^ (v == 0) not'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2008 |
self assert:(m literals includesIdentical:#'=='). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2009 |
self assert:(m literals includesIdentical:#'not'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2010 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2011 |
|
215 | 2012 |
m := self compile:'foo:arg ^ arg not'. |
2013 |
self assert:(m literals includesIdentical:#'not'). |
|
2014 |
||
2015 |
m := self compile:'foo:arg ^ arg notNil'. |
|
2016 |
self assert:(m literals includesIdentical:#'notNil'). |
|
2017 |
m := self compile:'foo:arg ^ arg isNil'. |
|
2018 |
self assert:(m literals includesIdentical:#'isNil'). |
|
2019 |
||
2020 |
||
213
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2021 |
m := self compile:'foo:arg |v| v := v+1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2022 |
self assert:(m literals includesIdentical:#'+'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2023 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2024 |
m := self compile:'foo:arg |v| v := v-1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2025 |
self assert:(m literals includesIdentical:#'-'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2026 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2027 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2028 |
m := self compile:'foo:arg |v| v := v not'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2029 |
self assert:(m literals includesIdentical:#'not'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2030 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2031 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2032 |
m := self compile:'foo:arg ^ arg ifTrue:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2033 |
self assert:(m literals includesIdentical:#'ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2034 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2035 |
m := self compile:'foo:arg ^ arg ifFalse:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2036 |
self assert:(m literals includesIdentical:#'ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2037 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2038 |
m := self compile:'foo:arg ^ arg ifTrue:1 ifFalse:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2039 |
self assert:(m literals includesIdentical:#'ifTrue:ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2040 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2041 |
m := self compile:'foo:arg ^ arg ifFalse:1 ifTrue:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2042 |
self assert:(m literals includesIdentical:#'ifFalse:ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2043 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2044 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2045 |
m := self compile:'foo:arg ^ arg isNil ifTrue:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2046 |
self assert:(m literals includesIdentical:#'ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2047 |
self assert:(m literals includesIdentical:#'isNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2048 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2049 |
m := self compile:'foo:arg ^ arg isNil ifFalse:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2050 |
self assert:(m literals includesIdentical:#'ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2051 |
self assert:(m literals includesIdentical:#'isNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2052 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2053 |
m := self compile:'foo:arg ^ arg isNil ifTrue:1 ifFalse:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2054 |
self assert:(m literals includesIdentical:#'ifTrue:ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2055 |
self assert:(m literals includesIdentical:#'isNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2056 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2057 |
m := self compile:'foo:arg ^ arg isNil ifFalse:1 ifTrue:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2058 |
self assert:(m literals includesIdentical:#'ifFalse:ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2059 |
self assert:(m literals includesIdentical:#'isNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2060 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2061 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2062 |
m := self compile:'foo:arg ^ arg notNil ifTrue:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2063 |
self assert:(m literals includesIdentical:#'ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2064 |
self assert:(m literals includesIdentical:#'notNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2065 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2066 |
m := self compile:'foo:arg ^ arg notNil ifFalse:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2067 |
self assert:(m literals includesIdentical:#'ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2068 |
self assert:(m literals includesIdentical:#'notNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2069 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2070 |
m := self compile:'foo:arg ^ arg notNil ifTrue:1 ifFalse:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2071 |
self assert:(m literals includesIdentical:#'ifTrue:ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2072 |
self assert:(m literals includesIdentical:#'notNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2073 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2074 |
m := self compile:'foo:arg ^ arg notNil ifFalse:1 ifTrue:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2075 |
self assert:(m literals includesIdentical:#'ifFalse:ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2076 |
self assert:(m literals includesIdentical:#'notNil'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2077 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2078 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2079 |
m := self compile:'foo:arg ^ arg not ifTrue:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2080 |
self assert:(m literals includesIdentical:#'ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2081 |
self assert:(m literals includesIdentical:#'not'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2082 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2083 |
m := self compile:'foo:arg ^ arg not ifFalse:1'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2084 |
self assert:(m literals includesIdentical:#'ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2085 |
self assert:(m literals includesIdentical:#'not'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2086 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2087 |
m := self compile:'foo:arg ^ arg not ifTrue:1 ifFalse:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2088 |
self assert:(m literals includesIdentical:#'ifTrue:ifFalse:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2089 |
self assert:(m literals includesIdentical:#'not'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2090 |
|
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2091 |
m := self compile:'foo:arg ^ arg not ifFalse:1 ifTrue:2'. |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2092 |
self assert:(m literals includesIdentical:#'ifFalse:ifTrue:'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2093 |
self assert:(m literals includesIdentical:#'not'). |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2094 |
|
214 | 2095 |
|
2096 |
m := self compile:'foo:arg ^ arg and:[true]'. |
|
2097 |
self assert:(m literals includesIdentical:#'and:'). |
|
2098 |
||
2099 |
m := self compile:'foo:arg ^ arg not and:[true]'. |
|
2100 |
self assert:(m literals includesIdentical:#'and:'). |
|
2101 |
self assert:(m literals includesIdentical:#'not'). |
|
2102 |
||
2103 |
m := self compile:'foo:arg ^ arg or:[true]'. |
|
2104 |
self assert:(m literals includesIdentical:#'or:'). |
|
2105 |
||
2106 |
m := self compile:'foo:arg ^ arg not or:[true]'. |
|
2107 |
self assert:(m literals includesIdentical:#'or:'). |
|
2108 |
self assert:(m literals includesIdentical:#'not'). |
|
2109 |
||
2110 |
m := self compile:'foo:arg ^ (arg or:[true]) ifTrue:[1234]'. |
|
2111 |
self assert:(m literals includesIdentical:#'or:'). |
|
2112 |
self assert:(m literals includesIdentical:#'ifTrue:'). |
|
2113 |
||
2114 |
m := self compile:'foo:arg ^ (arg or:[true]) ifFalse:[1234]'. |
|
2115 |
self assert:(m literals includesIdentical:#'or:'). |
|
2116 |
self assert:(m literals includesIdentical:#'ifFalse:'). |
|
2117 |
||
2118 |
m := self compile:'foo:arg ^ (arg or:[true]) ifTrue:1 ifFalse:2'. |
|
2119 |
self assert:(m literals includesIdentical:#'or:'). |
|
2120 |
self assert:(m literals includesIdentical:#'ifTrue:ifFalse:'). |
|
2121 |
||
2122 |
m := self compile:'foo:arg ^ (arg or:[true]) ifFalse:1 ifTrue:2'. |
|
2123 |
self assert:(m literals includesIdentical:#'or:'). |
|
2124 |
self assert:(m literals includesIdentical:#'ifFalse:ifTrue:'). |
|
2125 |
||
2126 |
||
2127 |
m := self compile:'foo:arg ^ [ ] loop'. |
|
2128 |
self assert:(m literals includesIdentical:#'loop'). |
|
2129 |
||
2130 |
m := self compile:'foo:arg ^ [ ] repeat'. |
|
2131 |
self assert:(m literals includesIdentical:#'repeat'). |
|
2132 |
||
2133 |
m := self compile:'foo:arg ^ arg ? 123'. |
|
2134 |
self assert:(m literals includesIdentical:#'?'). |
|
2135 |
||
213
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2136 |
" |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2137 |
self new testLiterals |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2138 |
" |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2139 |
! ! |
9764b38bebf5
test for all literals to be present in the method
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2140 |
|
188 | 2141 |
!CompilerTest::DummyClass methodsFor:'accessing'! |
2142 |
||
2143 |
_y0 |
|
2144 |
ObjectMemory garbageCollect. |
|
2145 |
^ self. |
|
2146 |
! |
|
2147 |
||
2148 |
_y1:arg1 |
|
2149 |
ObjectMemory garbageCollect. |
|
2150 |
^ arg1. |
|
2151 |
! |
|
2152 |
||
2153 |
request:something |
|
2154 |
"set the value of the instance variable 'request' (automatically generated)" |
|
2155 |
||
2156 |
request := something. |
|
2157 |
! ! |
|
2158 |
||
47 | 2159 |
!CompilerTest class methodsFor:'documentation'! |
2160 |
||
2161 |
version |
|
2162 |
^ '$Header$' |
|
2163 |
! ! |