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

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

Issue 12328143: pkg/unittest: Moved `fail` to matcher library (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixes to align with r19166 Created 7 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 | « pkg/unittest/lib/src/future_matchers.dart ('k') | pkg/unittest/test/unittest_test.dart » ('j') | 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, use the pub package manager. 8 * To import this library, use the pub package manager.
9 * Create a pubspec.yaml file in your project and add 9 * Create a pubspec.yaml file in your project and add
10 * a dependency on unittest with the following lines: 10 * a dependency on unittest with the following lines:
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 _config.onDone(passed > 0 && failed == 0 && errors == 0 && 821 _config.onDone(passed > 0 && failed == 0 && errors == 0 &&
822 _uncaughtErrorMessage == null); 822 _uncaughtErrorMessage == null);
823 _initialized = false; 823 _initialized = false;
824 } 824 }
825 825
826 String _fullSpec(String spec) { 826 String _fullSpec(String spec) {
827 if (spec == null) return '$_currentGroup'; 827 if (spec == null) return '$_currentGroup';
828 return _currentGroup != '' ? '$_currentGroup$groupSep$spec' : spec; 828 return _currentGroup != '' ? '$_currentGroup$groupSep$spec' : spec;
829 } 829 }
830 830
831 void fail(String message) {
832 throw new TestFailure(message);
833 }
834
835 /** 831 /**
836 * Lazily initializes the test library if not already initialized. 832 * Lazily initializes the test library if not already initialized.
837 */ 833 */
838 ensureInitialized() { 834 ensureInitialized() {
839 if (_initialized) { 835 if (_initialized) {
840 return; 836 return;
841 } 837 }
842 _initialized = true; 838 _initialized = true;
843 // Hook our async guard into the matcher library. 839 // Hook our async guard into the matcher library.
844 wrapAsync = expectAsync1; 840 wrapAsync = expectAsync1;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 } 881 }
886 882
887 /** Enable a test by ID. */ 883 /** Enable a test by ID. */
888 void enableTest(int testId) => _setTestEnabledState(testId, true); 884 void enableTest(int testId) => _setTestEnabledState(testId, true);
889 885
890 /** Disable a test by ID. */ 886 /** Disable a test by ID. */
891 void disableTest(int testId) => _setTestEnabledState(testId, false); 887 void disableTest(int testId) => _setTestEnabledState(testId, false);
892 888
893 /** Signature for a test function. */ 889 /** Signature for a test function. */
894 typedef dynamic TestFunction(); 890 typedef dynamic TestFunction();
OLDNEW
« no previous file with comments | « pkg/unittest/lib/src/future_matchers.dart ('k') | pkg/unittest/test/unittest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698