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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/webdriver/lib/webdriver.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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 * }); 140 * });
141 * // indicate that the asynchronous callback was invoked. 141 * // indicate that the asynchronous callback was invoked.
142 * async.complete(); 142 * async.complete();
143 * }); 143 * });
144 * }); 144 * });
145 * } 145 * }
146 * 146 *
147 */ 147 */
148 library unittest; 148 library unittest;
149 149
150 import 'dart:async';
150 import 'dart:isolate'; 151 import 'dart:isolate';
151 import 'matcher.dart'; 152 import 'matcher.dart';
152 export 'matcher.dart'; 153 export 'matcher.dart';
153 154
154 // TODO(amouravski): We should not need to import mock here, but it's necessary 155 // TODO(amouravski): We should not need to import mock here, but it's necessary
155 // to enable dartdoc on the mock library, as it's not picked up normally. 156 // to enable dartdoc on the mock library, as it's not picked up normally.
156 import 'mock.dart'; 157 import 'mock.dart';
157 158
158 part 'src/config.dart'; 159 part 'src/config.dart';
159 part 'src/test_case.dart'; 160 part 'src/test_case.dart';
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 void filterTests(testFilter) { 730 void filterTests(testFilter) {
730 var filterFunction; 731 var filterFunction;
731 if (testFilter is String) { 732 if (testFilter is String) {
732 RegExp re = new RegExp(testFilter); 733 RegExp re = new RegExp(testFilter);
733 filterFunction = (t) => re.hasMatch(t.description); 734 filterFunction = (t) => re.hasMatch(t.description);
734 } else if (testFilter is RegExp) { 735 } else if (testFilter is RegExp) {
735 filterFunction = (t) => testFilter.hasMatch(t.description); 736 filterFunction = (t) => testFilter.hasMatch(t.description);
736 } else if (testFilter is Function) { 737 } else if (testFilter is Function) {
737 filterFunction = testFilter; 738 filterFunction = testFilter;
738 } 739 }
739 _tests = _tests.filter(filterFunction); 740 _tests = _tests.where(filterFunction).toList();
740 } 741 }
741 742
742 /** Runs all queued tests, one at a time. */ 743 /** Runs all queued tests, one at a time. */
743 runTests() { 744 runTests() {
744 _currentTest = 0; 745 _currentTest = 0;
745 _currentGroup = ''; 746 _currentGroup = '';
746 747
747 // If we are soloing a test, remove all the others. 748 // If we are soloing a test, remove all the others.
748 if (_soloTest != null) { 749 if (_soloTest != null) {
749 filterTests((t) => t == _soloTest); 750 filterTests((t) => t == _soloTest);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 900 }
900 901
901 /** Enable a test by ID. */ 902 /** Enable a test by ID. */
902 void enableTest(int testId) => _setTestEnabledState(testId, true); 903 void enableTest(int testId) => _setTestEnabledState(testId, true);
903 904
904 /** Disable a test by ID. */ 905 /** Disable a test by ID. */
905 void disableTest(int testId) => _setTestEnabledState(testId, false); 906 void disableTest(int testId) => _setTestEnabledState(testId, false);
906 907
907 /** Signature for a test function. */ 908 /** Signature for a test function. */
908 typedef void TestFunction(); 909 typedef void TestFunction();
OLDNEW
« no previous file with comments | « pkg/unittest/lib/src/future_matchers.dart ('k') | pkg/webdriver/lib/webdriver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698