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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 case FAIL: testsFailed_++; break; | 831 case FAIL: testsFailed_++; break; |
832 case ERROR: testsErrors_++; break; | 832 case ERROR: testsErrors_++; break; |
833 } | 833 } |
834 } | 834 } |
835 _config.onDone(testsPassed_, testsFailed_, testsErrors_, _tests, | 835 _config.onDone(testsPassed_, testsFailed_, testsErrors_, _tests, |
836 _uncaughtErrorMessage); | 836 _uncaughtErrorMessage); |
837 _initialized = false; | 837 _initialized = false; |
838 } | 838 } |
839 | 839 |
840 String _fullSpec(String spec) { | 840 String _fullSpec(String spec) { |
841 if (spec === null) return '$_currentGroup'; | 841 if (spec == null) return '$_currentGroup'; |
842 return _currentGroup != '' ? '$_currentGroup$groupSep$spec' : spec; | 842 return _currentGroup != '' ? '$_currentGroup$groupSep$spec' : spec; |
843 } | 843 } |
844 | 844 |
845 void fail(String message) { | 845 void fail(String message) { |
846 throw new ExpectException(message); | 846 throw new ExpectException(message); |
847 } | 847 } |
848 | 848 |
849 /** | 849 /** |
850 * Lazily initializes the test library if not already initialized. | 850 * Lazily initializes the test library if not already initialized. |
851 */ | 851 */ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 } | 899 } |
900 | 900 |
901 /** Enable a test by ID. */ | 901 /** Enable a test by ID. */ |
902 void enableTest(int testId) => _setTestEnabledState(testId, true); | 902 void enableTest(int testId) => _setTestEnabledState(testId, true); |
903 | 903 |
904 /** Disable a test by ID. */ | 904 /** Disable a test by ID. */ |
905 void disableTest(int testId) => _setTestEnabledState(testId, false); | 905 void disableTest(int testId) => _setTestEnabledState(testId, false); |
906 | 906 |
907 /** Signature for a test function. */ | 907 /** Signature for a test function. */ |
908 typedef void TestFunction(); | 908 typedef void TestFunction(); |
OLD | NEW |