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

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

Issue 11412086: Make 'where' lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: FilteredIterable/Iterator -> WhereIterable/Iterator. Created 8 years, 1 month 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
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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 void filterTests(testFilter) { 730 void filterTests(testFilter) {
731 var filterFunction; 731 var filterFunction;
732 if (testFilter is String) { 732 if (testFilter is String) {
733 RegExp re = new RegExp(testFilter); 733 RegExp re = new RegExp(testFilter);
734 filterFunction = (t) => re.hasMatch(t.description); 734 filterFunction = (t) => re.hasMatch(t.description);
735 } else if (testFilter is RegExp) { 735 } else if (testFilter is RegExp) {
736 filterFunction = (t) => testFilter.hasMatch(t.description); 736 filterFunction = (t) => testFilter.hasMatch(t.description);
737 } else if (testFilter is Function) { 737 } else if (testFilter is Function) {
738 filterFunction = testFilter; 738 filterFunction = testFilter;
739 } 739 }
740 _tests = _tests.where(filterFunction); 740 _tests = _tests.where(filterFunction).toList();
741 } 741 }
742 742
743 /** Runs all queued tests, one at a time. */ 743 /** Runs all queued tests, one at a time. */
744 runTests() { 744 runTests() {
745 _currentTest = 0; 745 _currentTest = 0;
746 _currentGroup = ''; 746 _currentGroup = '';
747 747
748 // If we are soloing a test, remove all the others. 748 // If we are soloing a test, remove all the others.
749 if (_soloTest != null) { 749 if (_soloTest != null) {
750 filterTests((t) => t == _soloTest); 750 filterTests((t) => t == _soloTest);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } 900 }
901 901
902 /** Enable a test by ID. */ 902 /** Enable a test by ID. */
903 void enableTest(int testId) => _setTestEnabledState(testId, true); 903 void enableTest(int testId) => _setTestEnabledState(testId, true);
904 904
905 /** Disable a test by ID. */ 905 /** Disable a test by ID. */
906 void disableTest(int testId) => _setTestEnabledState(testId, false); 906 void disableTest(int testId) => _setTestEnabledState(testId, false);
907 907
908 /** Signature for a test function. */ 908 /** Signature for a test function. */
909 typedef void TestFunction(); 909 typedef void TestFunction();
OLDNEW
« no previous file with comments | « pkg/unittest/lib/mock.dart ('k') | runtime/lib/array.dart » ('j') | runtime/lib/array.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698