Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tests/corelib/test_config.dart

Issue 8492013: Add asynchronous test suite runner to Dart rewrite of test scripts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix TestRunnerTest to use new TestCase constructor. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #library("corelib_test_config");
6
7 #import("../../tools/testing/dart/test_runner.dart");
8
9 class CorelibTestSuite {
10 final String directoryPath = "tests/corelib/src";
11 Function doTest;
12 Function doDone;
13 String shellPath;
14 String pathSeparator;
15
16 CorelibTestSuite() {
17 shellPath = getDartShellFileName() ;
18 pathSeparator = new Platform().pathSeparator();
19 }
20
21 void forEachTest(Function onTest ,[Function onDone = null]) {
Mads Ager (google) 2011/11/08 14:58:21 Move comma to right after onTest.
22 doTest = onTest;
23 doDone = onDone;
24 processDirectory();
25 }
26
27 void processDirectory() {
28 Directory dir = new Directory(directoryPath);
29 if (!dir.existsSync()) {
30 dir = new Directory(".." + pathSeparator + directoryPath);
31 if (!dir.existsSync()) return;
Mads Ager (google) 2011/11/08 14:58:21 Instead of just returning here, shouldn't we throw
32 // TODO(ager): Use dir.errorHandler instead when it is implemented.
33 }
34 dir.fileHandler = processFile;
35 dir.doneHandler = doDone;
36 dir.list(false);
37 }
38
39 void processFile(String filename) {
40 if (filename.endsWith(".dart")) {
Mads Ager (google) 2011/11/08 14:58:21 Sorry, my mistake. I think currently there might b
41 int start = filename.lastIndexOf(pathSeparator);
42 String displayName = filename.substring(start + 1, filename.length - 5);
43 // TODO(whesse): Gather test case info from status file and test file.
44 doTest(new TestCase(displayName,
45 shellPath,
46 ["--enable_type_checks",
47 "--ignore-unrecognized-flags",
Mads Ager (google) 2011/11/08 14:58:21 Indentation. I would do: ["--...", "--...", fil
48 filename ],
49 completeHandler,
50 new Set.from([PASS, FAIL, CRASH, TIMEOUT])));
51 }
52 }
53
54 void completeHandler(TestCase testCase) {
55 TestOutput output = testCase.output;
56 print("Exit code: ${output.exitCode} Time: ${output.time}");
57 }
58 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/src/TestRunnerTest.dart » ('j') | tests/standalone/src/TestRunnerTest.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698