Chromium Code Reviews| Index: tests/corelib/test_config.dart |
| diff --git a/tests/corelib/test_config.dart b/tests/corelib/test_config.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b1a1cc883daecd65c5aa1c7463d38a11c6b32565 |
| --- /dev/null |
| +++ b/tests/corelib/test_config.dart |
| @@ -0,0 +1,58 @@ |
| +// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#library("corelib_test_config"); |
| + |
| +#import("../../tools/testing/dart/test_runner.dart"); |
| + |
| +class CorelibTestSuite { |
| + final String directoryPath = "tests/corelib/src"; |
| + Function doTest; |
| + Function doDone; |
| + String shellPath; |
| + String pathSeparator; |
| + |
| + CorelibTestSuite() { |
| + shellPath = getDartShellFileName() ; |
| + pathSeparator = new Platform().pathSeparator(); |
| + } |
| + |
| + void forEachTest(Function onTest ,[Function onDone = null]) { |
|
Mads Ager (google)
2011/11/08 14:58:21
Move comma to right after onTest.
|
| + doTest = onTest; |
| + doDone = onDone; |
| + processDirectory(); |
| + } |
| + |
| + void processDirectory() { |
| + Directory dir = new Directory(directoryPath); |
| + if (!dir.existsSync()) { |
| + dir = new Directory(".." + pathSeparator + directoryPath); |
| + if (!dir.existsSync()) return; |
|
Mads Ager (google)
2011/11/08 14:58:21
Instead of just returning here, shouldn't we throw
|
| + // TODO(ager): Use dir.errorHandler instead when it is implemented. |
| + } |
| + dir.fileHandler = processFile; |
| + dir.doneHandler = doDone; |
| + dir.list(false); |
| + } |
| + |
| + void processFile(String filename) { |
| + if (filename.endsWith(".dart")) { |
|
Mads Ager (google)
2011/11/08 14:58:21
Sorry, my mistake. I think currently there might b
|
| + int start = filename.lastIndexOf(pathSeparator); |
| + String displayName = filename.substring(start + 1, filename.length - 5); |
| + // TODO(whesse): Gather test case info from status file and test file. |
| + doTest(new TestCase(displayName, |
| + shellPath, |
| + ["--enable_type_checks", |
| + "--ignore-unrecognized-flags", |
|
Mads Ager (google)
2011/11/08 14:58:21
Indentation. I would do:
["--...",
"--...",
fil
|
| + filename ], |
| + completeHandler, |
| + new Set.from([PASS, FAIL, CRASH, TIMEOUT]))); |
| + } |
| + } |
| + |
| + void completeHandler(TestCase testCase) { |
| + TestOutput output = testCase.output; |
| + print("Exit code: ${output.exitCode} Time: ${output.time}"); |
| + } |
| +} |