@@ -89,15 +89,15 @@ class ConsoleRunner extends DirectRunner {
89
89
NestUI .verbose(" adding test file " + file)
90
90
testFiles = file :: testFiles
91
91
} else {
92
- NestUI .failure(" File \" " + arg + " \" not found" )
92
+ NestUI .failure(" File \" " + arg + " \" not found\n " )
93
93
System .exit(1 )
94
94
}
95
95
} else if (out eq con) {
96
96
val file = new File (arg)
97
97
if (file.isFile || file.createNewFile)
98
98
out = new PrintStream (new FileOutputStream (file))
99
99
else {
100
- NestUI .failure(" Result file \" " + arg + " \" not found" )
100
+ NestUI .failure(" Result file \" " + arg + " \" not found\n " )
101
101
System .exit(1 )
102
102
}
103
103
} else
@@ -162,24 +162,15 @@ class ConsoleRunner extends DirectRunner {
162
162
163
163
def runTests (kind : String , check : Boolean , msg : String ): (Int , Int ) = {
164
164
if (check) {
165
- val kindFiles =
166
- if (! testFiles.isEmpty) {
167
- NestUI .verbose(" testing " + testFiles)
168
- testFiles
169
- }
170
- else if (kind == " res" ) // TODO: is there a nicer way?
171
- fileManager.getFiles(kind, check, " .res" )
172
- else
173
- fileManager.getFiles(kind, check)
165
+ val kindFiles = if (kind == " res" ) // TODO: is there a nicer way?
166
+ fileManager.getFiles(kind, check, " .res" )
167
+ else
168
+ fileManager.getFiles(kind, check)
174
169
if (! kindFiles.isEmpty) {
175
170
NestUI .outline(" \n " + msg+ " \n " )
176
-
177
171
runTestsForFiles(kindFiles, kind)
178
-
179
- // val worker = new Worker
180
- // worker.runTests(kind, kindFiles)
181
172
} else {
182
- NestUI .failure(" test dir empty" )
173
+ NestUI .failure(" test dir empty\n " )
183
174
(0 , 0 )
184
175
}
185
176
} else (0 , 0 )
@@ -189,6 +180,41 @@ class ConsoleRunner extends DirectRunner {
189
180
* @return (success count, failure count)
190
181
*/
191
182
def testCheckAll (): (Int , Int ) = {
183
+ def runTestsFiles = if (! testFiles.isEmpty) {
184
+ def absName (f : File ): String = f.getAbsoluteFile.getCanonicalPath
185
+
186
+ def kindOf (f : File ): String = {
187
+ val firstName = absName(f)
188
+ val filesPos = firstName.indexOf(" files" )
189
+ if (filesPos == - 1 ) {
190
+ NestUI .failure(" invalid test file: " + firstName+ " \n " )
191
+ Predef .exit(1 )
192
+ } else {
193
+ val k = firstName.substring(filesPos+ 6 , filesPos+ 6 + 3 )
194
+ val short = if (k == " jvm" ) {
195
+ if (firstName.substring(filesPos+ 6 , filesPos+ 6 + 4 ) == " jvm5" ) " jvm5"
196
+ else k
197
+ } else k
198
+ val shortKinds = List (" pos" , " neg" , " run" , " jvm" , " jvm5" , " res" )
199
+ if (shortKinds contains short) short
200
+ else short match {
201
+ case " sho" => " shootout"
202
+ case " scr" => " script"
203
+ }
204
+ }
205
+ }
206
+
207
+ val fstKind = kindOf(testFiles.head)
208
+ NestUI .verbose(" all test files expected to have kind " + fstKind)
209
+ if (! testFiles.forall(kindOf(_) equals fstKind)) {
210
+ NestUI .failure(" test files have different kinds\n " )
211
+ Predef .exit(1 )
212
+ } else {
213
+ NestUI .outline(" \n Testing individual files\n " )
214
+ runTestsForFiles(testFiles, fstKind)
215
+ }
216
+ } else (0 , 0 )
217
+
192
218
if (runAll) { // run all tests
193
219
posCheck = true
194
220
negCheck = true
@@ -199,7 +225,8 @@ class ConsoleRunner extends DirectRunner {
199
225
shootoutCheck = true
200
226
scriptCheck = true
201
227
}
202
- val results = List (runTests(" pos" , posCheck, " Testing compiler (on files whose compilation should succeed)" ),
228
+ val results = List (runTestsFiles,
229
+ runTests(" pos" , posCheck, " Testing compiler (on files whose compilation should succeed)" ),
203
230
runTests(" neg" , negCheck, " Testing compiler (on files whose compilation should fail)" ),
204
231
runTests(" run" , runCheck, " Testing JVM backend" ),
205
232
runTests(" jvm" , jvmCheck, " Testing JVM backend" ),
0 commit comments