author | Jan Vrany <jan.vrany@labware.com> |
Thu, 27 Oct 2022 14:53:59 +0100 | |
branch | jv |
changeset 4735 | 3b11fb3ede98 |
parent 4315 | 734f7d2b6efe |
permissions | -rw-r--r-- |
4315
734f7d2b6efe
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
2538
diff
changeset
|
1 |
"{ Encoding: utf8 }" |
734f7d2b6efe
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
2538
diff
changeset
|
2 |
|
2499 | 3 |
" |
4 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libcomp' }" |
|
15 |
||
16 |
TestCase subclass:#ByteCodeCompilerWithBreakpointSupportTests |
|
17 |
instanceVariableNames:'breakpoints method' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'System-Compiler-Debugging' |
|
21 |
! |
|
22 |
||
23 |
!ByteCodeCompilerWithBreakpointSupportTests class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
38 |
||
39 |
!ByteCodeCompilerWithBreakpointSupportTests methodsFor:'accessing'! |
|
40 |
||
41 |
breakpoints |
|
42 |
^ breakpoints |
|
43 |
! ! |
|
44 |
||
45 |
!ByteCodeCompilerWithBreakpointSupportTests methodsFor:'running'! |
|
46 |
||
47 |
tearDown |
|
48 |
||
49 |
self class removeSelector: #foo. |
|
50 |
breakpoints := nil. |
|
51 |
||
52 |
"Created: / 16-06-2011 / 14:58:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
53 |
"Modified: / 17-06-2011 / 09:00:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
54 |
! ! |
|
55 |
||
56 |
!ByteCodeCompilerWithBreakpointSupportTests methodsFor:'tests'! |
|
57 |
||
58 |
test_01 |
|
59 |
||
60 |
|source| |
|
61 |
||
62 |
source := 'foo ^ #foo'. |
|
63 |
||
64 |
breakpoints := Array with:(Breakpoint new position:4). |
|
65 |
||
66 |
self compile:source. |
|
67 |
||
68 |
self should:[ self foo ] raise:HaltInterrupt. |
|
69 |
||
70 |
"Created: / 16-06-2011 / 14:17:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
71 |
"Modified: / 17-06-2011 / 09:03:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2538 | 72 |
"Modified: / 05-07-2011 / 21:08:33 / cg" |
2499 | 73 |
! |
74 |
||
75 |
test_02 |
|
76 |
||
77 |
| source | |
|
78 |
||
79 |
source := 'foo | a | a := 1. ^ a + 1'. |
|
80 |
||
81 |
breakpoints := Array with: (Breakpoint new position:19). |
|
82 |
||
83 |
self compile:source. |
|
84 |
||
85 |
self should:[self foo] raise: HaltInterrupt. |
|
86 |
||
87 |
"Created: / 16-06-2011 / 15:23:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
88 |
"Modified: / 17-06-2011 / 09:00:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89 |
! |
|
90 |
||
91 |
test_03a |
|
92 |
||
93 |
| source | |
|
94 |
||
95 |
source := 'foo ^ true ifTrue:[ #true ] ifFalse:[ #false ]' . |
|
96 |
"12345678901234567890123456789012345678901234567890" |
|
97 |
||
98 |
breakpoints := Array with: (Breakpoint new position:20). |
|
99 |
||
100 |
self compile:source. |
|
101 |
||
102 |
self should:[self foo] raise: HaltInterrupt. |
|
103 |
||
104 |
"Created: / 17-06-2011 / 09:05:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
105 |
! |
|
106 |
||
107 |
test_03b |
|
108 |
||
2538 | 109 |
| source ret | |
2499 | 110 |
|
111 |
source := 'foo ^ true ifTrue:[ #true ] ifFalse:[ #false ]' . |
|
112 |
"12345678901234567890123456789012345678901234567890" |
|
2538 | 113 |
" 1 2 3 4" |
2499 | 114 |
|
115 |
breakpoints := Array with: (Breakpoint new position:28). |
|
116 |
||
117 |
self compile:source. |
|
2538 | 118 |
"/ method inspect. |
2499 | 119 |
|
120 |
self shouldnt:[self foo] raise: HaltInterrupt. |
|
121 |
||
2538 | 122 |
HaltInterrupt ignoreIn:[ |
123 |
ret := self foo. |
|
124 |
]. |
|
125 |
self assert:(ret == #true) |
|
126 |
||
2499 | 127 |
"Created: / 17-06-2011 / 09:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2538 | 128 |
"Modified: / 05-07-2011 / 22:54:08 / cg" |
129 |
! |
|
130 |
||
131 |
test_03c |
|
132 |
||
133 |
| source ret | |
|
134 |
||
135 |
source := 'foo ^ false ifTrue:[ #true ] ifFalse:[ #false ]' . |
|
136 |
"12345678901234567890123456789012345678901234567890" |
|
137 |
" 1 2 3 4" |
|
138 |
||
139 |
breakpoints := Array with: (Breakpoint new position:28). |
|
140 |
||
141 |
self compile:source. |
|
142 |
"/ method inspect. |
|
143 |
||
144 |
self shouldnt:[self foo] raise: HaltInterrupt. |
|
145 |
||
146 |
HaltInterrupt ignoreIn:[ |
|
147 |
ret := self foo. |
|
148 |
]. |
|
149 |
self assert:(ret == #false) |
|
150 |
||
151 |
"Created: / 17-06-2011 / 09:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
152 |
"Created: / 05-07-2011 / 22:54:54 / cg" |
|
2499 | 153 |
! |
154 |
||
155 |
test_04 |
|
156 |
||
157 |
| source block | |
|
158 |
||
159 |
source := 'foo ^ [ #true ]' . |
|
160 |
"12345678901234567890123456789012345678901234567890" |
|
161 |
||
162 |
breakpoints := Array with: (Breakpoint new position:8). |
|
163 |
||
164 |
self compile:source. |
|
165 |
||
166 |
self shouldnt:[block := self foo] raise: HaltInterrupt. |
|
167 |
self should:[block value] raise: HaltInterrupt. |
|
168 |
||
169 |
"Created: / 17-06-2011 / 09:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
170 |
! |
|
171 |
||
172 |
test_05 |
|
173 |
||
174 |
| source got result | |
|
175 |
||
176 |
source := 'foo | a | a := 100. ^a between: a-a and: a+a' . |
|
177 |
"12345678901234567890123456789012345678901234567890" |
|
2538 | 178 |
" 1 2 3 4" |
2499 | 179 |
|
180 |
breakpoints := Array with: (Breakpoint new position:32). |
|
181 |
||
182 |
self compile:source. |
|
2538 | 183 |
"/ method inspect. |
2499 | 184 |
|
185 |
got := false. |
|
186 |
[ result := self foo ] |
|
187 |
on: HaltInterrupt do: |
|
188 |
[:halt| |
|
189 |
got := true. |
|
190 |
halt proceed]. |
|
191 |
||
192 |
self assert: got. |
|
193 |
self assert: result |
|
194 |
||
195 |
"Created: / 17-06-2011 / 09:14:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2538 | 196 |
"Modified: / 05-07-2011 / 22:20:25 / cg" |
2499 | 197 |
! |
198 |
||
199 |
test_06 |
|
200 |
||
201 |
| source nbreaks result | |
|
202 |
||
203 |
source := 'foo |a| 1 to: 10 do:[:x| a := x * x ]. ^a ' . |
|
204 |
"12345678901234567890123456789012345678901234567890" |
|
205 |
||
206 |
breakpoints := Array with: (Breakpoint new position:30). |
|
207 |
||
208 |
self compile:source. |
|
2538 | 209 |
"/ method inspect. |
2499 | 210 |
|
211 |
nbreaks := 0. |
|
212 |
[ result := self foo ] |
|
213 |
on: HaltInterrupt do: |
|
214 |
[:halt| |
|
215 |
nbreaks := nbreaks + 1. |
|
216 |
halt proceed]. |
|
217 |
||
218 |
self assert: nbreaks == 10. |
|
219 |
self assert: result == 100 |
|
220 |
||
221 |
"Created: / 17-06-2011 / 11:56:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2538 | 222 |
"Modified: / 05-07-2011 / 22:40:31 / cg" |
2499 | 223 |
! ! |
224 |
||
225 |
!ByteCodeCompilerWithBreakpointSupportTests methodsFor:'utils'! |
|
226 |
||
227 |
compile:source |
|
228 |
Class withoutUpdatingChangesDo:[ |
|
229 |
method := |
|
230 |
ByteCodeCompilerWithBreakpointSupport |
|
231 |
compile:source |
|
232 |
forClass:self class |
|
233 |
notifying:self |
|
234 |
]. |
|
2538 | 235 |
^ method |
2499 | 236 |
|
237 |
"Modified: / 17-06-2011 / 09:15:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2538 | 238 |
"Modified (format): / 05-07-2011 / 21:36:29 / cg" |
2499 | 239 |
! ! |
240 |
||
241 |
!ByteCodeCompilerWithBreakpointSupportTests class methodsFor:'documentation'! |
|
242 |
||
243 |
version_CVS |
|
2538 | 244 |
^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompilerWithBreakpointSupportTests.st,v 1.2 2011-07-05 21:25:22 cg Exp $' |
2499 | 245 |
! |
246 |
||
247 |
version_SVN |
|
4315
734f7d2b6efe
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
2538
diff
changeset
|
248 |
^ '§ Id §' |
2499 | 249 |
! ! |