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

Side by Side Diff: tests/standalone/io/test_runner_test.dart

Issue 13724021: Remove deprecated Expect from the libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import "dart:io"; 5 import "dart:io";
6 import "dart:isolate"; 6 import "dart:isolate";
7 import "dart:async"; 7 import "dart:async";
8 import "dart:utf"; 8 import "dart:utf";
9 import "../../../tools/testing/dart/test_runner.dart"; 9 import "../../../tools/testing/dart/test_runner.dart";
10 import "../../../tools/testing/dart/test_suite.dart"; 10 import "../../../tools/testing/dart/test_suite.dart";
11 import "../../../tools/testing/dart/status_file_parser.dart"; 11 import "../../../tools/testing/dart/status_file_parser.dart";
12 import "../../../tools/testing/dart/test_options.dart"; 12 import "../../../tools/testing/dart/test_options.dart";
13 import "process_test_util.dart"; 13 import "process_test_util.dart";
14 14
15 final DEFAULT_TIMEOUT = 2; 15 final DEFAULT_TIMEOUT = 2;
16 final LONG_TIMEOUT = 30; 16 final LONG_TIMEOUT = 30;
17 17
18 class TestController { 18 class TestController {
19 static int numTests = 0; 19 static int numTests = 0;
20 static int numCompletedTests = 0; 20 static int numCompletedTests = 0;
21 21
22 // Used as TestCase.completedCallback. 22 // Used as TestCase.completedCallback.
23 static processCompletedTest(TestCase testCase) { 23 static processCompletedTest(TestCase testCase) {
24 numCompletedTests++; 24 numCompletedTests++;
25 CommandOutput output = testCase.lastCommandOutput; 25 CommandOutput output = testCase.lastCommandOutput;
26 if (testCase.displayName == "fail-unexpected") { 26 if (testCase.displayName == "fail-unexpected") {
27 Expect.isTrue(output.unexpectedOutput); 27 if (!output.unexpectedOutput) {
28 throw new Exception("Expected fail-unexpected");
29 }
28 } else { 30 } else {
29 Expect.isFalse(output.unexpectedOutput); 31 if (output.unexpectedOutput) {
32 throw new Exception("Unexpected fail");
33 }
30 } 34 }
31 } 35 }
32 36
33 static void finished() { 37 static void finished() {
34 Expect.equals(numTests, numCompletedTests); 38 if (numTests != numCompletedTests) {
39 throw new Exception("bad completion count. " +
Lasse Reichstein Nielsen 2013/04/08 11:27:49 Remove '+'?
floitsch 2013/04/08 16:06:59 Done.
40 "expected: $numTests, actual: $numCompletedTests");
41 }
35 } 42 }
36 } 43 }
37 44
38 45
39 class CustomTestSuite extends TestSuite { 46 class CustomTestSuite extends TestSuite {
40 CustomTestSuite() : super({}, "CustomTestSuite"); 47 CustomTestSuite() : super({}, "CustomTestSuite");
41 48
42 void forEachTest(TestCaseEvent onTest, Map testCache, [onDone]) { 49 void forEachTest(TestCaseEvent onTest, Map testCache, [onDone]) {
43 void enqueueTestCase(testCase) { 50 void enqueueTestCase(testCase) {
44 TestController.numTests++; 51 TestController.numTests++;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // fail, or timeout. 111 // fail, or timeout.
105 var arguments = new Options().arguments; 112 var arguments = new Options().arguments;
106 if (arguments.isEmpty) { 113 if (arguments.isEmpty) {
107 testProcessQueue(); 114 testProcessQueue();
108 } else { 115 } else {
109 switch (arguments[0]) { 116 switch (arguments[0]) {
110 case 'pass': 117 case 'pass':
111 return; 118 return;
112 case 'fail-unexpected': 119 case 'fail-unexpected':
113 case 'fail': 120 case 'fail':
114 Expect.fail("This test always fails, to test the test scripts."); 121 throw new Exception(
122 "This test always fails, to test the test scripts.");
115 break; 123 break;
116 case 'timeout': 124 case 'timeout':
117 // Run for 10 seconds, then exit. This tests a 2 second timeout. 125 // Run for 10 seconds, then exit. This tests a 2 second timeout.
118 new Timer(new Duration(seconds: 10), (){ }); 126 new Timer(new Duration(seconds: 10), (){ });
119 break; 127 break;
120 default: 128 default:
121 throw "Unknown option ${arguments[0]} passed to test_runner_test"; 129 throw "Unknown option ${arguments[0]} passed to test_runner_test";
122 } 130 }
123 } 131 }
124 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698