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

Side by Side Diff: tests/standalone/src/TestRunnerTest.dart

Issue 9510002: test.dart: fix TestRunnerTest actual tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("TestRunnerTest"); 5 #library("TestRunnerTest");
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("../../../tools/testing/dart/test_runner.dart"); 8 #import("../../../tools/testing/dart/test_runner.dart");
9 #import("../../../tools/testing/dart/status_file_parser.dart"); 9 #import("../../../tools/testing/dart/status_file_parser.dart");
10 #source("ProcessTestUtil.dart"); 10 #source("ProcessTestUtil.dart");
11 11
12 class TestController { 12 class TestController {
13 static final int numTests = 4; 13 static final int numTests = 4;
14 static int numCompletedTests = 0; 14 static int numCompletedTests = 0;
15 15
16 // Used as TestCase.completedCallback. 16 // Used as TestCase.completedCallback.
17 static processCompletedTest(TestCase testCase) { 17 static processCompletedTest(TestCase testCase) {
18 TestOutput output = testCase.output; 18 TestOutput output = testCase.output;
19 print("Test: ${testCase.commandLine}"); 19 print("Test: ${testCase.commands.last().commandLine}");
20 if (output.unexpectedOutput) { 20 if (output.unexpectedOutput) {
21 throw "Unexpected output: ${output.result}"; 21 throw "Unexpected output: ${output.result}";
22 } 22 }
23 print("stdout: "); 23 print("stdout: ");
24 for (var line in output.stdout) print(line); 24 for (var line in output.stdout) print(line);
25 print("stderr: "); 25 print("stderr: ");
26 for (var line in output.stderr) print(line); 26 for (var line in output.stderr) print(line);
27 27
28 print("Time: ${output.time}"); 28 print("Time: ${output.time}");
29 print("Exit code: ${output.exitCode}"); 29 print("Exit code: ${output.exitCode}");
(...skipping 10 matching lines...) Expand all
40 TestCase MakeTestCase(String testName, List<String> expectations) { 40 TestCase MakeTestCase(String testName, List<String> expectations) {
41 String test_path = "tests/standalone/src/${testName}.dart"; 41 String test_path = "tests/standalone/src/${testName}.dart";
42 // Working directory may be dart/runtime rather than dart. 42 // Working directory may be dart/runtime rather than dart.
43 if (!new File(test_path).existsSync()) { 43 if (!new File(test_path).existsSync()) {
44 test_path = "../tests/standalone/src/${testName}.dart"; 44 test_path = "../tests/standalone/src/${testName}.dart";
45 } 45 }
46 46
47 var configuration = { 'timeout': 2, 47 var configuration = { 'timeout': 2,
48 'special-command': '' }; 48 'special-command': '' };
49 return new TestCase(testName, 49 return new TestCase(testName,
50 getDartFileName(), 50 [new Command(getDartFileName(),
51 <String>["--ignore-unrecognized-flags", 51 <String>["--ignore-unrecognized-flags",
52 "--enable_type_checks", 52 "--enable_type_checks",
53 test_path], 53 test_path])],
54 configuration, 54 configuration,
55 TestController.processCompletedTest, 55 TestController.processCompletedTest,
56 new Set<String>.from(expectations)); 56 new Set<String>.from(expectations));
57 } 57 }
58 58
59 59
60 void main() { 60 void main() {
61 var configuration = { 'timeout': 2, 61 var configuration = { 'timeout': 2,
62 'special-command': '' }; 62 'special-command': '' };
63 new RunningProcess(MakeTestCase("PassTest", [PASS])).start(); 63 new RunningProcess(MakeTestCase("PassTest", [PASS])).start();
64 new RunningProcess(MakeTestCase("FailTest", [FAIL])).start(); 64 new RunningProcess(MakeTestCase("FailTest", [FAIL])).start();
65 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT])).start(); 65 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT])).start();
66 66
67 new RunningProcess(new TestCase("CrashTest", 67 new RunningProcess(new TestCase("CrashTest",
68 getProcessTestFileName(), 68 [new Command(getProcessTestFileName(),
69 const ["0", "0", "1", "1"], 69 const ["0", "0", "1", "1"])],
70 configuration, 70 configuration,
71 TestController.processCompletedTest, 71 TestController.processCompletedTest,
72 new Set<String>.from([CRASH]))).start(); 72 new Set<String>.from([CRASH]))).start();
73 Expect.equals(4, TestController.numTests); 73 Expect.equals(4, TestController.numTests);
74 // Throw must be from body of start() function for this test to work. 74 // Throw must be from body of start() function for this test to work.
75 Expect.throws(new RunningProcess(MakeTestCase("PassTest", [SKIP])).start); 75 Expect.throws(new RunningProcess(MakeTestCase("PassTest", [SKIP])).start);
76 } 76 }
77 77
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698