69
|
1 |
"{ Package: 'exept:regression' }"
|
58
|
2 |
|
70
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
58
|
5 |
Object subclass:#BlockTest
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
59
|
9 |
category:'Tests-Regression'
|
58
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!BlockTest class methodsFor:'varArgBlocks'!
|
|
14 |
|
|
15 |
getVarArgBlock1
|
|
16 |
|b|
|
|
17 |
|
|
18 |
b := [:argList | Transcript
|
70
|
19 |
show:'invoked with args:';
|
|
20 |
showCR:argList
|
|
21 |
] asVarArgBlock.
|
58
|
22 |
^ b
|
|
23 |
|
|
24 |
|
|
25 |
!
|
|
26 |
|
|
27 |
getVarArgBlock2
|
|
28 |
|b|
|
|
29 |
|
|
30 |
b := [:argList | Transcript
|
70
|
31 |
show:'invoked with args:';
|
|
32 |
showCR:argList.
|
|
33 |
argList
|
|
34 |
] asVarArgBlock.
|
58
|
35 |
^ b
|
|
36 |
|
|
37 |
|
|
38 |
!
|
|
39 |
|
|
40 |
getVarArgBlock3
|
|
41 |
|b|
|
|
42 |
|
|
43 |
b := [:argList | Transcript
|
70
|
44 |
show:'invoked with args:';
|
|
45 |
showCR:argList.
|
|
46 |
argList size
|
|
47 |
] asVarArgBlock.
|
58
|
48 |
^ b
|
|
49 |
|
|
50 |
|
|
51 |
!
|
|
52 |
|
|
53 |
testAll
|
|
54 |
self testVarArgBlocks.
|
|
55 |
|
|
56 |
"
|
|
57 |
self testAll
|
|
58 |
"
|
|
59 |
!
|
|
60 |
|
|
61 |
testVarArgBlock1
|
|
62 |
|b|
|
|
63 |
|
|
64 |
b := self getVarArgBlock1.
|
|
65 |
|
|
66 |
b value.
|
60
|
67 |
b code notNil ifTrue:[
|
70
|
68 |
Transcript showCR:'blocks code is jitted'
|
60
|
69 |
] ifFalse:[
|
70
|
70 |
Transcript showCR:'*** blocks code is NOT jitted'
|
60
|
71 |
].
|
|
72 |
|
|
73 |
b value.
|
58
|
74 |
b value:'arg1'.
|
|
75 |
b value:'arg1' value:'arg2' value:'arg3' value:'arg4'
|
|
76 |
|
|
77 |
"
|
|
78 |
self testVarArgBlock1
|
|
79 |
"
|
|
80 |
!
|
|
81 |
|
|
82 |
testVarArgBlock2
|
|
83 |
|b|
|
|
84 |
|
|
85 |
b := self getVarArgBlock2.
|
|
86 |
|
60
|
87 |
b value.
|
|
88 |
b code notNil ifTrue:[
|
70
|
89 |
Transcript showCR:'blocks code is jitted'
|
60
|
90 |
] ifFalse:[
|
70
|
91 |
Transcript showCR:'*** blocks code is NOT jitted'
|
60
|
92 |
].
|
|
93 |
|
58
|
94 |
b value = #() ifFalse:[ self halt ].
|
|
95 |
(b value:1) = #(1) ifFalse:[ self halt ].
|
|
96 |
(b value:1 value:2) = #(1 2) ifFalse:[ self halt ].
|
|
97 |
(b value:1 value:2 value:3) = #(1 2 3) ifFalse:[ self halt ].
|
|
98 |
(b value:1 value:2 value:3 value:4) = #(1 2 3 4) ifFalse:[ self halt ].
|
|
99 |
(b valueWithArguments:#(1 2 3 4)) = #(1 2 3 4) ifFalse:[ self halt ].
|
|
100 |
|
|
101 |
(b perform:#value) = #() ifFalse:[ self halt ].
|
|
102 |
(b perform:#'value:' with:1) = #(1) ifFalse:[ self halt ].
|
|
103 |
(b perform:#'value:value:' with:1 with:2) = #(1 2) ifFalse:[ self halt ].
|
|
104 |
(b perform:#'value:value:value:' with:1 with:2 with:3) = #(1 2 3) ifFalse:[ self halt ].
|
|
105 |
(b perform:#'value:value:value:value:' with:1 with:2 with:3 with:4) = #(1 2 3 4) ifFalse:[ self halt ].
|
|
106 |
(b perform:#'valueWithArguments:' with:#(1 2 3 4)) = #(1 2 3 4) ifFalse:[ self halt ].
|
|
107 |
|
|
108 |
"
|
|
109 |
self testVarArgBlock2
|
|
110 |
"
|
|
111 |
!
|
|
112 |
|
|
113 |
testVarArgBlock3
|
|
114 |
|b|
|
|
115 |
|
|
116 |
b := self getVarArgBlock3.
|
|
117 |
|
60
|
118 |
b value.
|
|
119 |
b code notNil ifTrue:[
|
70
|
120 |
Transcript showCR:'blocks code is jitted'
|
60
|
121 |
] ifFalse:[
|
70
|
122 |
Transcript showCR:'*** blocks code is NOT jitted'
|
60
|
123 |
].
|
|
124 |
|
58
|
125 |
b value = 0 ifFalse:[ self halt ].
|
|
126 |
(b value:1) = 1 ifFalse:[ self halt ].
|
|
127 |
(b value:1 value:2) = 2 ifFalse:[ self halt ].
|
|
128 |
(b value:1 value:2 value:3) = 3 ifFalse:[ self halt ].
|
|
129 |
(b value:1 value:2 value:3 value:4) = 4 ifFalse:[ self halt ].
|
|
130 |
(b valueWithArguments:#(1 2 3 4)) = 4 ifFalse:[ self halt ].
|
|
131 |
|
|
132 |
(b perform:#value) = 0 ifFalse:[ self halt ].
|
|
133 |
(b perform:#'value:' with:1) = 1 ifFalse:[ self halt ].
|
|
134 |
(b perform:#'value:value:' with:1 with:2) = 2 ifFalse:[ self halt ].
|
|
135 |
(b perform:#'value:value:value:' with:1 with:2 with:3) = 3 ifFalse:[ self halt ].
|
|
136 |
(b perform:#'value:value:value:value:' with:1 with:2 with:3 with:4) = 4 ifFalse:[ self halt ].
|
|
137 |
(b perform:#'valueWithArguments:' with:#(1 2 3 4)) = 4 ifFalse:[ self halt ].
|
|
138 |
|
|
139 |
"
|
|
140 |
self testVarArgBlock3
|
|
141 |
"
|
|
142 |
!
|
|
143 |
|
|
144 |
testVarArgBlocks
|
|
145 |
self testVarArgBlock1.
|
|
146 |
self testVarArgBlock2.
|
|
147 |
self testVarArgBlock3.
|
|
148 |
|
|
149 |
! !
|
|
150 |
|
|
151 |
!BlockTest class methodsFor:'documentation'!
|
|
152 |
|
|
153 |
version
|
|
154 |
^ '$Header$'
|
|
155 |
! !
|