Chromium Code Reviews| Index: tests/standalone/src/TestRunnerTest.dart |
| diff --git a/tests/standalone/src/TestRunnerTest.dart b/tests/standalone/src/TestRunnerTest.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8ecb78b47472a32773aff30e668712fd0f71099e |
| --- /dev/null |
| +++ b/tests/standalone/src/TestRunnerTest.dart |
| @@ -0,0 +1,56 @@ |
| +// 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("TestRunnerTest"); |
| + |
| + |
| +#import("../../../tools/testing/dart/test_runner.dart"); |
| + |
| +class TestController { |
| + static final int numTests = 4; |
| + static int numCompletedTests = 0; |
| + |
| + // Used as TestCase.completedCallback. |
| + static processCompletedTest(TestCase testCase) { |
| + TestOutput output = testCase.output; |
| + print("Test: ${testCase.commandLine}"); |
| + if (output.unexpectedOutput) { |
| + print("Unexpected output: ${output.result}"); |
| + } |
| + print("stdout: "); |
| + for (var line in output.stdout) print(line); |
| + print("stderr: "); |
| + for (var line in output.stderr) print(line); |
| + |
| + print("Time: ${output.time}"); |
| + print("Exit code: ${output.exitCode}"); |
| + |
| + ++numCompletedTests; |
| + print("$numCompletedTests/$numTests"); |
| + if (numCompletedTests == numTests) { |
| + TimerChecks.timer.cancel(); |
| + } |
| + } |
| +} |
| + |
| +TestCase MakeTestCase(String testName, List<String> expectations) { |
| + return new TestCase("out/Debug_ia32/dart_bin", <String>[ |
|
Søren Gjesse
2011/11/04 09:05:34
This path does not work cross platform/mode, see h
Bill Hesse
2011/11/04 14:49:22
Done.
|
| + "--ignore-unrecognized-flags", |
| + "--enable_type_checks", |
| + "tests/standalone/src/$testName.dart"], |
|
Søren Gjesse
2011/11/04 09:05:34
Maybe use ${testName} for clarity.
Bill Hesse
2011/11/04 14:49:22
Done.
|
| + TestController.processCompletedTest, |
| + new Set<String>.from(expectations)); |
| +} |
| + |
| +void main() { |
| + new RunningProcess(MakeTestCase("PassTest", [PASS]), 30).start(); |
| + new RunningProcess(MakeTestCase("FailTest", [FAIL]), 30).start(); |
| + new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), 30).start(); |
| + new RunningProcess(MakeTestCase("CrashTest", [CRASH]), 30).start(); |
| + Expect.equals(4, TestController.numTests); |
| + Expect.throws(() => |
|
Mads Ager (google)
2011/11/04 09:06:13
Funky indentation and you don't need the () => ...
Bill Hesse
2011/11/04 14:49:22
Done.
|
| + new RunningProcess(MakeTestCase("CrashTest", [SKIP]), 30).start() |
| + ); |
| +} |
| + |