Chromium Code Reviews| OLD | NEW |
|---|---|
| (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("TestRunnerTest"); | |
| 6 | |
| 7 | |
| 8 #import("../../../tools/testing/dart/test_runner.dart"); | |
| 9 | |
| 10 class TestController { | |
| 11 static final int numTests = 4; | |
| 12 static int numCompletedTests = 0; | |
| 13 | |
| 14 // Used as TestCase.completedCallback. | |
| 15 static processCompletedTest(TestCase testCase) { | |
| 16 TestOutput output = testCase.output; | |
| 17 print("Test: ${testCase.commandLine}"); | |
| 18 if (output.unexpectedOutput) { | |
| 19 print("Unexpected output: ${output.result}"); | |
| 20 } | |
| 21 print("stdout: "); | |
| 22 for (var line in output.stdout) print(line); | |
| 23 print("stderr: "); | |
| 24 for (var line in output.stderr) print(line); | |
| 25 | |
| 26 print("Time: ${output.time}"); | |
| 27 print("Exit code: ${output.exitCode}"); | |
| 28 | |
| 29 ++numCompletedTests; | |
| 30 print("$numCompletedTests/$numTests"); | |
| 31 if (numCompletedTests == numTests) { | |
| 32 TimerChecks.timer.cancel(); | |
| 33 } | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 TestCase MakeTestCase(String testName, List<String> expectations) { | |
| 38 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.
| |
| 39 "--ignore-unrecognized-flags", | |
| 40 "--enable_type_checks", | |
| 41 "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.
| |
| 42 TestController.processCompletedTest, | |
| 43 new Set<String>.from(expectations)); | |
| 44 } | |
| 45 | |
| 46 void main() { | |
| 47 new RunningProcess(MakeTestCase("PassTest", [PASS]), 30).start(); | |
| 48 new RunningProcess(MakeTestCase("FailTest", [FAIL]), 30).start(); | |
| 49 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), 30).start(); | |
| 50 new RunningProcess(MakeTestCase("CrashTest", [CRASH]), 30).start(); | |
| 51 Expect.equals(4, TestController.numTests); | |
| 52 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.
| |
| 53 new RunningProcess(MakeTestCase("CrashTest", [SKIP]), 30).start() | |
| 54 ); | |
| 55 } | |
| 56 | |
| OLD | NEW |