author | Claus Gittinger <cg@exept.de> |
Fri, 01 Nov 2019 13:44:29 +0100 | |
branch | cvs_MAIN |
changeset 3973 | ee0b2d717637 |
parent 3412 | df11bb428463 |
permissions | -rw-r--r-- |
749 | 1 |
" |
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3025
diff
changeset
|
2 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
4 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
5 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3025
diff
changeset
|
6 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 7 |
SWING Research Group, Czech Technical University in Prague |
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
16 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
17 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
18 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
19 |
as of 1.9.2010 |
749 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
3330
b14c58b2876c
Oops, moved stray reloading-related methods from stx:libjava/experiments to stx:libjava.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
23 |
"{ NameSpace: Smalltalk }" |
b14c58b2876c
Oops, moved stray reloading-related methods from stx:libjava/experiments to stx:libjava.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
24 |
|
749 | 25 |
JavaTestCaseProxy subclass:#TestletTestCaseProxy |
26 |
instanceVariableNames:'harness' |
|
27 |
classVariableNames:'TestCases' |
|
28 |
poolDictionaries:'' |
|
29 |
category:'Languages-Java-Tests-Proxies' |
|
30 |
! |
|
31 |
||
32 |
!TestletTestCaseProxy class methodsFor:'documentation'! |
|
33 |
||
34 |
copyright |
|
35 |
" |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3025
diff
changeset
|
36 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
37 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
38 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
39 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3025
diff
changeset
|
40 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 41 |
SWING Research Group, Czech Technical University in Prague |
42 |
||
43 |
This software is furnished under a license and may be used |
|
44 |
only in accordance with the terms of that license and with the |
|
45 |
inclusion of the above copyright notice. This software may not |
|
46 |
be provided or otherwise made available to, or used by, any |
|
47 |
other person. No title to or ownership of the software is |
|
48 |
hereby transferred. |
|
49 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
50 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
51 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
52 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
53 |
as of 1.9.2010 |
749 | 54 |
|
55 |
" |
|
56 |
! ! |
|
57 |
||
58 |
!TestletTestCaseProxy class methodsFor:'accessing'! |
|
59 |
||
60 |
lookupHierarchyRoot |
|
61 |
^ TestletTestCaseProxy |
|
62 |
||
63 |
"Created: / 01-03-2011 / 11:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
64 |
"Modified: / 01-03-2011 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
65 |
"Modified: / 29-04-2011 / 10:25:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
66 |
! |
|
67 |
||
68 |
selector: aSymbol |
|
69 |
||
70 |
^super selector: aSymbol |
|
71 |
||
72 |
"Created: / 01-03-2011 / 11:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
73 |
! ! |
|
74 |
||
75 |
!TestletTestCaseProxy class methodsFor:'private'! |
|
76 |
||
77 |
testSelectors |
|
78 |
"testlet always has only one test method, but maybe for the future.." |
|
79 |
||
80 |
^ #( #'test(Lgnu/testlet/TestHarness;)V' ). |
|
81 |
||
82 |
"Created: / 01-03-2011 / 10:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
83 |
"Modified: / 03-03-2011 / 00:34:39 / Marcel Hlopko <hlopik@gmail.com>" |
|
84 |
"Modified: / 29-05-2011 / 22:54:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
85 |
"Modified: / 09-08-2011 / 16:31:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
86 |
! ! |
|
87 |
||
88 |
!TestletTestCaseProxy class methodsFor:'queries'! |
|
89 |
||
90 |
isTestlet |
|
91 |
^ true |
|
92 |
||
93 |
! ! |
|
94 |
||
95 |
!TestletTestCaseProxy class methodsFor:'subclass creation'! |
|
96 |
||
97 |
for: javaClass |
|
98 |
"Answers a new (anonymous) testcase proxy for |
|
99 |
given javaClass" |
|
100 |
||
101 |
self assert: javaClass isJavaClass description: 'Not a java class'. |
|
102 |
self assert: javaClass isTestletLike |
|
103 |
description: 'Not a testcase-like class'. |
|
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
104 |
^self forClassNamed: javaClass binaryName |
749 | 105 |
|
106 |
"Created: / 01-03-2011 / 10:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
107 |
"Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>" |
|
108 |
"Modified: / 29-04-2011 / 10:21:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
109 |
"Modified: / 08-10-2013 / 22:28:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 110 |
! ! |
111 |
||
112 |
!TestletTestCaseProxy methodsFor:'accessing'! |
|
113 |
||
114 |
nameForHDTestReport |
|
115 |
||
116 |
^(self class javaClassName copyReplaceAll:$/ with: $.) copyTo: (self class javaClassName lastIndexOf: $/) - 1. |
|
117 |
||
118 |
"Created: / 01-04-2011 / 16:10:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
119 |
||
120 |
! |
|
121 |
||
122 |
selectorForHDTestReport |
|
123 |
||
124 |
^self class javaClassName copyFrom: |
|
125 |
(self class javaClassName lastIndexOf: $/) + 1 |
|
126 |
||
127 |
||
128 |
||
129 |
! ! |
|
130 |
||
131 |
!TestletTestCaseProxy methodsFor:'error handling'! |
|
132 |
||
133 |
doesNotUnderstand: msg |
|
134 |
||
135 |
"Here, we have to emulate stx.libjava.tests.TestHarness.Proxy interface..." |
|
136 |
| sel | |
|
137 |
||
138 |
sel := msg selector. |
|
139 |
(sel includes:$() ifTrue:[ |
|
140 |
sel == #'check(Z)V' ifTrue:[ |
|
141 |
^self assert: msg arg1 == 1 description: ('Assertion failed (checkpoint: %1)' bindWith: self checkPointName). |
|
142 |
]. |
|
143 |
sel == #'message(Ljava/lang/String;I)V' ifTrue:[ |
|
144 |
| text type | |
|
145 |
text := Java as_ST_String: msg arg1. |
|
146 |
type := msg arguments at: 2. |
|
147 |
^self message: text type: type. |
|
148 |
]. |
|
149 |
sel == #'directory(I)Ljava/lang/String;' ifTrue:[ |
|
150 |
^Java as_String: (self directory: msg arg1) asString. |
|
151 |
]. |
|
152 |
]. |
|
153 |
^super doesNotUnderstand: msg |
|
154 |
||
155 |
"Created: / 31-05-2011 / 16:30:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
156 |
! ! |
|
157 |
||
158 |
!TestletTestCaseProxy methodsFor:'private'! |
|
159 |
||
160 |
checkPointName |
|
161 |
||
162 |
| jstring | |
|
163 |
jstring := harness instVarNamed: #checkPoint. |
|
164 |
^jstring notNil ifTrue:[ |
|
165 |
Java as_ST_String: jstring |
|
166 |
] ifFalse:[ |
|
167 |
'<no checkpoint set>' |
|
168 |
] |
|
169 |
||
170 |
"Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
171 |
"Created: / 09-08-2011 / 12:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
172 |
! |
|
173 |
||
174 |
createHarness |
|
175 |
||
176 |
harness := (Java classForName: 'stx.libjava.tests.TestHarness') new. |
|
177 |
harness instVarNamed: #proxy put: self. |
|
178 |
||
179 |
"Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
180 |
"Created: / 09-08-2011 / 11:29:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
181 |
! |
|
182 |
||
183 |
performTest |
|
2917
e634189c444e
Another pass over java.io.* natives. Fixes for OpenJDK 7.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
184 |
|
e634189c444e
Another pass over java.io.* natives. Fixes for OpenJDK 7.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
185 |
<resource: #skipInDebuggersWalkBack> |
e634189c444e
Another pass over java.io.* natives. Fixes for OpenJDK 7.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
186 |
|
749 | 187 |
self createHarness. |
3025
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
188 |
"/ JavaVM unimplementedNativeMethodSignal is Signal, not exception. |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
189 |
"/ Therefore it MUST be caught here!!!!!! |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
190 |
[ |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
191 |
self javaClass new |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
192 |
perform: 'test(Lgnu/testlet/TestHarness;)V' sunitAsSymbol |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
193 |
with: harness. |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
194 |
] on: JavaVM unimplementedNativeMethodSignal do:[:ex| |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
195 |
ex class sunitSignalWith: ex description |
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
196 |
] |
749 | 197 |
|
198 |
"Created: / 01-03-2011 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
199 |
"Modified: / 05-12-2011 / 21:15:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3025
e2137bf62524
Fix in JUnit/TestletTestCaseProxy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2917
diff
changeset
|
200 |
"Modified (comment): / 12-02-2014 / 12:33:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 201 |
! ! |
202 |
||
203 |
!TestletTestCaseProxy methodsFor:'private - Proxy interface'! |
|
204 |
||
205 |
directory: type |
|
206 |
" |
|
207 |
public static final int DIR_TMP = 1; |
|
208 |
public static final int DIR_SRC = 2; |
|
209 |
public static final int DIR_RES = 3; |
|
210 |
public static final int DIR_BLD = 4; |
|
211 |
" |
|
212 |
||
213 |
type == 1 ifTrue:[ |
|
214 |
^Filename newTemporaryDirectory. |
|
215 |
] ifFalse:[type == 2 ifTrue:[ |
|
2917
e634189c444e
Another pass over java.io.* natives. Fixes for OpenJDK 7.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
216 |
"/ ^JavaTestsResource classpathForMauve anyOne asFilename directory / 'bin' |
e634189c444e
Another pass over java.io.* natives. Fixes for OpenJDK 7.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
217 |
^JavaTestsResource classpathForMauve anyOne asFilename directory / 'src' |
749 | 218 |
] ifFalse:[type == 3 ifTrue:[ |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
219 |
^(JavaTestsResource classpathForMauve anyOne asFilename directory / 'src') asString , Filename separator |
749 | 220 |
] ifFalse:[type == 4 ifTrue:[ |
221 |
^JavaTestsResource classpathForMauve anyOne asFilename |
|
222 |
] ifFalse:[ |
|
223 |
^self error:'Unknown type code' |
|
224 |
]]]]. |
|
225 |
||
226 |
"Created: / 10-08-2011 / 15:03:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2917
e634189c444e
Another pass over java.io.* natives. Fixes for OpenJDK 7.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
227 |
"Modified: / 13-11-2013 / 09:55:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 228 |
! |
229 |
||
230 |
message:msg type: type |
|
231 |
" |
|
232 |
public static final int MSG_DBG = 1; |
|
233 |
public static final int MSG_INF = 2; |
|
234 |
public static final int MSG_ERR = 3; |
|
235 |
" |
|
236 |
type == 1 ifTrue:[Transcript showCR:' Testlet [DBG]: '] ifFalse:[ |
|
237 |
type == 2 ifTrue:[Transcript showCR:' Testlet [INF]: '] ifFalse:[ |
|
238 |
type == 3 ifTrue:[Transcript showCR:' Testlet [ERR]: '] ifFalse:[ |
|
239 |
Transcript showCR:' Testlet [???]: ']]]. |
|
240 |
Transcript showCR: msg. |
|
241 |
type == 3 ifTrue:[self error: msg]. |
|
242 |
||
243 |
"Created: / 10-08-2011 / 15:06:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
244 |
! ! |
|
245 |
||
246 |
!TestletTestCaseProxy class methodsFor:'documentation'! |
|
247 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
248 |
version_CVS |
3412
df11bb428463
Merged with mercurial revision 4f3cc813be4 (8 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3360
diff
changeset
|
249 |
^ '$Header: /cvs/stx/stx/libjava/TestletTestCaseProxy.st,v 1.6 2015-03-20 12:08:01 vrany Exp $' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
250 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
251 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
252 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
253 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
254 |
^ '$Changeset: <not expanded> $' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
255 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
256 |
|
749 | 257 |
version_SVN |
2731
13f5be2bf83b
Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
258 |
^ 'Id' |
2152 | 259 |
! ! |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
260 |