| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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(); |
| OLD | NEW |