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

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

Issue 10909123: Fix issue 2933 - if an exception is thrown before we start the first test, but after the testcase i… (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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 _handleCallbackFunctionComplete(); 655 _handleCallbackFunctionComplete();
656 } 656 }
657 657
658 /** 658 /**
659 * Utility function that can be used to notify the test framework that an 659 * Utility function that can be used to notify the test framework that an
660 * error was caught outside of this library. 660 * error was caught outside of this library.
661 */ 661 */
662 void _reportTestError(String msg, String trace) { 662 void _reportTestError(String msg, String trace) {
663 if (_currentTest < _tests.length) { 663 if (_currentTest < _tests.length) {
664 final testCase = _tests[_currentTest]; 664 final testCase = _tests[_currentTest];
665 testCase.error(msg, trace); 665 if (testCase.running) {
Siggi Cherem (dart-lang) 2012/09/07 17:13:23 seems that this means that also tests that fail af
gram 2012/09/07 17:40:53 I thought about that. I have mixed feelings about
666 if (testCase.callbackFunctionsOutstanding > 0) { 666 testCase.error(msg, trace);
667 _nextTestCase(); 667 if (testCase.callbackFunctionsOutstanding > 0) {
668 _nextTestCase();
669 }
670 return;
668 } 671 }
669 } else {
670 _uncaughtErrorMessage = "$msg: $trace";
671 } 672 }
673 _uncaughtErrorMessage = "$msg: $trace";
672 } 674 }
673 675
674 /** Runs [callback] at the end of the event loop. */ 676 /** Runs [callback] at the end of the event loop. */
675 _defer(void callback()) { 677 _defer(void callback()) {
676 // Exploit isolate ports as a platform-independent mechanism to queue a 678 // Exploit isolate ports as a platform-independent mechanism to queue a
677 // message at the end of the event loop. 679 // message at the end of the event loop.
678 // TODO(sigmund): expose this functionality somewhere in our libraries. 680 // TODO(sigmund): expose this functionality somewhere in our libraries.
679 final port = new ReceivePort(); 681 final port = new ReceivePort();
680 port.receive((msg, reply) { 682 port.receive((msg, reply) {
681 callback(); 683 callback();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 } 866 }
865 867
866 /** Enable a test by ID. */ 868 /** Enable a test by ID. */
867 void enableTest(int testId) => _setTestEnabledState(testId, true); 869 void enableTest(int testId) => _setTestEnabledState(testId, true);
868 870
869 /** Disable a test by ID. */ 871 /** Disable a test by ID. */
870 void disableTest(int testId) => _setTestEnabledState(testId, false); 872 void disableTest(int testId) => _setTestEnabledState(testId, false);
871 873
872 /** Signature for a test function. */ 874 /** Signature for a test function. */
873 typedef void TestFunction(); 875 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