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

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: Allow for close event - read handler call bug. 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
« no previous file with comments | « tests/standalone/src/PassTest.dart ('k') | tests/standalone/src/TimeoutTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1f001ae4e5a22a5242ea6dc93a49197960fc30c6
--- /dev/null
+++ b/tests/standalone/src/TestRunnerTest.dart
@@ -0,0 +1,65 @@
+
+// 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");
+
+// TODO(whesse) source("ProcessTestUtil.dart"); when it is committed.
+
+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) {
+ print("TestRunnerTest.dart PASSED");
+ }
+ }
+}
+
+TestCase MakeTestCase(String testName, List<String> expectations) {
+ return new TestCase(getDartShellFileName(), <String>[
+ "--ignore-unrecognized-flags",
+ "--enable_type_checks",
+ "tests/standalone/src/${testName}.dart"],
+ 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();
+
+ // TODO(whesse): Replace process_test with getProcessTestFileName().
+ new RunningProcess(new TestCase("out/Debug_ia32/process_test",
+ const ["0", "0", "1", "1"],
+ TestController.processCompletedTest,
+ new Set<String>.from([CRASH])),
+ 30).start();
+ Expect.equals(4, TestController.numTests);
+ // Throw must be from body of start() function for this test to work.
+ Expect.throws(
+ new RunningProcess(MakeTestCase("PassTest", [SKIP]), 30).start);
+}
+
« no previous file with comments | « tests/standalone/src/PassTest.dart ('k') | tests/standalone/src/TimeoutTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698