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

Unified Diff: tests/standalone/src/TestRunnerTest.dart

Issue 8440066: Add test_runner.dart to Dart version of test scripts. Include TestRunnerTest unit test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Skip TimeoutTest on dartium 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 side-by-side diff with in-line comments
Download patch
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()
+ );
+}
+

Powered by Google App Engine
This is Rietveld 408576698