author | Claus Gittinger <cg@exept.de> |
Tue, 26 Mar 2019 18:29:29 +0100 | |
changeset 2180 | 582380e4d050 |
parent 1447 | 2351db93aa5b |
child 1500 | d406a10b2965 |
permissions | -rw-r--r-- |
1447 | 1 |
"{ Package: 'stx:goodies/regression' }" |
224 | 2 |
|
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#DebuggerTest |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'tests-Regression' |
|
10 |
! |
|
11 |
||
12 |
!DebuggerTest class methodsFor:'documentation'! |
|
13 |
||
14 |
documentation |
|
15 |
" |
|
16 |
documentation to be added. |
|
17 |
||
18 |
[author:] |
|
1447 | 19 |
Claus Gittinger (cg@alan) |
224 | 20 |
|
21 |
[instance variables:] |
|
22 |
||
23 |
[class variables:] |
|
24 |
||
25 |
[see also:] |
|
26 |
||
27 |
" |
|
28 |
! |
|
29 |
||
30 |
history |
|
31 |
"Created: / 11.11.2003 / 17:21:55 / cg" |
|
32 |
! ! |
|
33 |
||
227
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
34 |
!DebuggerTest methodsFor:'helpers'! |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
35 |
|
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
36 |
step:nr |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
37 |
Transcript show:'step '; showCR:nr |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
38 |
! ! |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
39 |
|
224 | 40 |
!DebuggerTest methodsFor:'tests'! |
41 |
||
42 |
testBlockVars_01 |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
43 |
|a b me contextInspectorOK| |
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
44 |
|
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
45 |
contextInspectorOK := true. |
224 | 46 |
|
47 |
a := #( 1 2 3 4 ). |
|
48 |
b := #( 9 8 7 6 ). |
|
49 |
a do:[:eachA | |
|
1447 | 50 |
b do:[:eachB | |
51 |
" you should see both eachA and eachB in the debugger " |
|
52 |
" eachA must be 1 |
|
53 |
eachB must be 9 |
|
54 |
" |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
55 |
|
1447 | 56 |
"/ cg: wait for the debugger to come up, |
57 |
"/ take a look at its local-variables inspector... |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
58 |
|
1447 | 59 |
me := Processor activeProcess. |
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
60 |
|
1447 | 61 |
[ |
62 |
|debuggers theDebugger fieldList idx| |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
63 |
|
1447 | 64 |
Delay waitForSeconds:0.5. |
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
65 |
|
1447 | 66 |
debuggers := DebugView allInstances select:[:dbg | dbg inspectedProcess == me]. |
67 |
self assert:(debuggers size == 1). |
|
68 |
theDebugger := debuggers first. |
|
69 |
fieldList := theDebugger contextInspector fieldList. |
|
70 |
idx := fieldList findFirst:[:e | e string startsWith:'eachB ']. |
|
71 |
idx == 0 ifTrue:[ |
|
72 |
contextInspectorOK := false |
|
73 |
] ifFalse:[ |
|
74 |
(theDebugger contextInspector valueAtLine:idx) == eachB ifFalse:[ |
|
75 |
contextInspectorOK := false |
|
76 |
]. |
|
77 |
]. |
|
78 |
idx := fieldList findFirst:[:e | e string startsWith:'eachA ']. |
|
79 |
idx == 0 ifTrue:[ |
|
80 |
contextInspectorOK := false |
|
81 |
] ifFalse:[ |
|
82 |
(theDebugger contextInspector valueAtLine:idx) == eachA ifFalse:[ |
|
83 |
contextInspectorOK := false |
|
84 |
]. |
|
85 |
]. |
|
86 |
me interruptWith:[theDebugger doAbort "AbortOperationRequest raise"]. |
|
87 |
] fork. |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
88 |
|
1447 | 89 |
AbortOperationRequest handle:[:ex | |
90 |
] do:[ |
|
91 |
self halt:'checking variables in the debugger...'. |
|
92 |
]. |
|
93 |
self assert:contextInspectorOK. |
|
94 |
] |
|
224 | 95 |
] |
96 |
||
97 |
" |
|
98 |
self run:#testBlockVars_01 |
|
99 |
self new testBlockVars_01 |
|
100 |
" |
|
101 |
! |
|
102 |
||
103 |
testBlockVars_02 |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
104 |
|a b contextInspectorOK me| |
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
105 |
|
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
106 |
contextInspectorOK := true. |
224 | 107 |
|
108 |
a := #( 1 2 3 4 ). |
|
109 |
b := #( 9 8 7 6 ). |
|
110 |
a do:[:eachA | |
|
1447 | 111 |
|outer| |
224 | 112 |
|
1447 | 113 |
outer := eachA + 1. |
114 |
b do:[:eachB | |
|
115 |
|inner| |
|
224 | 116 |
|
1447 | 117 |
inner := eachB + 1. |
224 | 118 |
|
1447 | 119 |
" you should see both eachA and eachB and outer and inner in the debugger " |
120 |
" eachA must be 1 ; outer must be 2 |
|
121 |
eachB must be 9 ; inner must be 10. |
|
122 |
" |
|
123 |
"/ cg: wait for the debugger to come up, |
|
124 |
"/ take a look at its local-variables inspector... |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
125 |
|
1447 | 126 |
me := Processor activeProcess. |
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
127 |
|
1447 | 128 |
[ |
129 |
|debuggers theDebugger fieldList idx| |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
130 |
|
1447 | 131 |
Delay waitForSeconds:0.5. |
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
132 |
|
1447 | 133 |
debuggers := DebugView allInstances select:[:dbg | dbg inspectedProcess == me]. |
134 |
self assert:(debuggers size == 1). |
|
135 |
theDebugger := debuggers first. |
|
136 |
fieldList := theDebugger contextInspector fieldList. |
|
137 |
idx := fieldList findFirst:[:e | e string startsWith:'eachB ']. |
|
138 |
idx == 0 ifTrue:[ |
|
139 |
contextInspectorOK := false |
|
140 |
] ifFalse:[ |
|
141 |
(theDebugger contextInspector valueAtLine:idx) == eachB ifFalse:[ |
|
142 |
contextInspectorOK := false |
|
143 |
]. |
|
144 |
]. |
|
145 |
idx := fieldList findFirst:[:e | e string startsWith:'eachA ']. |
|
146 |
idx == 0 ifTrue:[ |
|
147 |
contextInspectorOK := false |
|
148 |
] ifFalse:[ |
|
149 |
(theDebugger contextInspector valueAtLine:idx) == eachA ifFalse:[ |
|
150 |
contextInspectorOK := false |
|
151 |
]. |
|
152 |
]. |
|
153 |
me interruptWith:[theDebugger doAbort "AbortOperationRequest raise"]. |
|
154 |
] fork. |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
155 |
|
1447 | 156 |
AbortOperationRequest handle:[:ex | |
157 |
] do:[ |
|
158 |
self halt:'checking variables in the debugger...'. |
|
159 |
]. |
|
160 |
self assert:contextInspectorOK. |
|
161 |
] |
|
224 | 162 |
] |
163 |
||
164 |
" |
|
165 |
self run:#testBlockVars_02 |
|
166 |
self new testBlockVars_02 |
|
167 |
" |
|
227
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
168 |
! |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
169 |
|
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
170 |
testSteppingInEnsureBlock_01 |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
171 |
self halt:'proceed stepping with "next"-Button'. |
1447 | 172 |
" |
227
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
173 |
you should be able to single-step through all step-sends... |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
174 |
" |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
175 |
self step:1. |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
176 |
[ |
1447 | 177 |
self step:2. |
178 |
self step:3. |
|
227
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
179 |
] ensure:[ |
1447 | 180 |
self step:4 |
227
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
181 |
]. |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
182 |
self step:5 |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
183 |
|
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
184 |
" |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
185 |
self run:#testSteppingInEnsureBlock_01 |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
186 |
self new testSteppingInEnsureBlock_01 |
357913273519
testcase for stepping through ensure: blocks
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
187 |
" |
224 | 188 |
! ! |
189 |
||
190 |
!DebuggerTest class methodsFor:'documentation'! |
|
191 |
||
192 |
version |
|
193 |
^ '$Header$' |
|
194 |
! ! |
|
1154
57df8373f219
class: RegressionTests::DebuggerTest
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
195 |