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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/src/PassTest.dart ('k') | tests/standalone/src/TimeoutTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file.
5
6 #library("TestRunnerTest");
7
8
9 #import("../../../tools/testing/dart/test_runner.dart");
10
11 // TODO(whesse) source("ProcessTestUtil.dart"); when it is committed.
12
13 class TestController {
14 static final int numTests = 4;
15 static int numCompletedTests = 0;
16
17 // Used as TestCase.completedCallback.
18 static processCompletedTest(TestCase testCase) {
19 TestOutput output = testCase.output;
20 print("Test: ${testCase.commandLine}");
21 if (output.unexpectedOutput) {
22 print("Unexpected output: ${output.result}");
23 }
24 print("stdout: ");
25 for (var line in output.stdout) print(line);
26 print("stderr: ");
27 for (var line in output.stderr) print(line);
28
29 print("Time: ${output.time}");
30 print("Exit code: ${output.exitCode}");
31
32 ++numCompletedTests;
33 print("$numCompletedTests/$numTests");
34 if (numCompletedTests == numTests) {
35 print("TestRunnerTest.dart PASSED");
36 }
37 }
38 }
39
40 TestCase MakeTestCase(String testName, List<String> expectations) {
41 return new TestCase(getDartShellFileName(), <String>[
42 "--ignore-unrecognized-flags",
43 "--enable_type_checks",
44 "tests/standalone/src/${testName}.dart"],
45 TestController.processCompletedTest,
46 new Set<String>.from(expectations));
47 }
48
49 void main() {
50 new RunningProcess(MakeTestCase("PassTest", [PASS]), 30).start();
51 new RunningProcess(MakeTestCase("FailTest", [FAIL]), 30).start();
52 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), 30).start();
53
54 // TODO(whesse): Replace process_test with getProcessTestFileName().
55 new RunningProcess(new TestCase("out/Debug_ia32/process_test",
56 const ["0", "0", "1", "1"],
57 TestController.processCompletedTest,
58 new Set<String>.from([CRASH])),
59 30).start();
60 Expect.equals(4, TestController.numTests);
61 // Throw must be from body of start() function for this test to work.
62 Expect.throws(
63 new RunningProcess(MakeTestCase("PassTest", [SKIP]), 30).start);
64 }
65
OLDNEW
« 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