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

Side by Side Diff: pkg/unittest/unittest.dart

Issue 10959074: Make PASS, FAIL, ERROR public (see issue 5365). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « pkg/unittest/test_case.dart ('k') | 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 /** 5 /**
6 * A library for writing dart unit tests. 6 * A library for writing dart unit tests.
7 * 7 *
8 * To import this library, specify the relative path to 8 * To import this library, specify the relative path to
9 * pkg/unittest/unittest.dart. 9 * pkg/unittest/unittest.dart.
10 * 10 *
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 Function _testTeardown; 199 Function _testTeardown;
200 200
201 /** Current test being executed. */ 201 /** Current test being executed. */
202 int _currentTest = 0; 202 int _currentTest = 0;
203 203
204 /** Whether the framework is in an initialized state. */ 204 /** Whether the framework is in an initialized state. */
205 bool _initialized = false; 205 bool _initialized = false;
206 206
207 String _uncaughtErrorMessage = null; 207 String _uncaughtErrorMessage = null;
208 208
209 const _PASS = 'pass'; 209 const PASS = 'pass';
210 const _FAIL = 'fail'; 210 const FAIL = 'fail';
211 const _ERROR = 'error'; 211 const ERROR = 'error';
212 212
213 /** If set, then all other test cases will be ignored. */ 213 /** If set, then all other test cases will be ignored. */
214 TestCase _soloTest; 214 TestCase _soloTest;
215 215
216 /** 216 /**
217 * (Deprecated) Evaluates the [function] and validates that it throws an 217 * (Deprecated) Evaluates the [function] and validates that it throws an
218 * exception. If [callback] is provided, then it will be invoked with the 218 * exception. If [callback] is provided, then it will be invoked with the
219 * thrown exception. The callback may do any validation it wants. In addition, 219 * thrown exception. The callback may do any validation it wants. In addition,
220 * if it returns `false`, that also indicates an expectation failure. 220 * if it returns `false`, that also indicates an expectation failure.
221 */ 221 */
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 792
793 /** Publish results on the page and notify controller. */ 793 /** Publish results on the page and notify controller. */
794 _completeTests() { 794 _completeTests() {
795 if (!_initialized) return; 795 if (!_initialized) return;
796 int testsPassed_ = 0; 796 int testsPassed_ = 0;
797 int testsFailed_ = 0; 797 int testsFailed_ = 0;
798 int testsErrors_ = 0; 798 int testsErrors_ = 0;
799 799
800 for (TestCase t in _tests) { 800 for (TestCase t in _tests) {
801 switch (t.result) { 801 switch (t.result) {
802 case _PASS: testsPassed_++; break; 802 case PASS: testsPassed_++; break;
803 case _FAIL: testsFailed_++; break; 803 case FAIL: testsFailed_++; break;
804 case _ERROR: testsErrors_++; break; 804 case ERROR: testsErrors_++; break;
805 } 805 }
806 } 806 }
807 _config.onDone(testsPassed_, testsFailed_, testsErrors_, _tests, 807 _config.onDone(testsPassed_, testsFailed_, testsErrors_, _tests,
808 _uncaughtErrorMessage); 808 _uncaughtErrorMessage);
809 _initialized = false; 809 _initialized = false;
810 } 810 }
811 811
812 String _fullSpec(String spec) { 812 String _fullSpec(String spec) {
813 if (spec === null) return '$_currentGroup'; 813 if (spec === null) return '$_currentGroup';
814 return _currentGroup != '' ? '$_currentGroup$groupSep$spec' : spec; 814 return _currentGroup != '' ? '$_currentGroup$groupSep$spec' : spec;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } 869 }
870 870
871 /** Enable a test by ID. */ 871 /** Enable a test by ID. */
872 void enableTest(int testId) => _setTestEnabledState(testId, true); 872 void enableTest(int testId) => _setTestEnabledState(testId, true);
873 873
874 /** Disable a test by ID. */ 874 /** Disable a test by ID. */
875 void disableTest(int testId) => _setTestEnabledState(testId, false); 875 void disableTest(int testId) => _setTestEnabledState(testId, false);
876 876
877 /** Signature for a test function. */ 877 /** Signature for a test function. */
878 typedef void TestFunction(); 878 typedef void TestFunction();
OLDNEW
« no previous file with comments | « pkg/unittest/test_case.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698