| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  461 } |  461 } | 
|  462  |  462  | 
|  463 /** |  463 /** | 
|  464  * Indicate that [callback] is expected to be called a [count] number of times |  464  * Indicate that [callback] is expected to be called a [count] number of times | 
|  465  * (by default 1). The unittest framework will wait for the callback to run the |  465  * (by default 1). The unittest framework will wait for the callback to run the | 
|  466  * specified [count] times before it continues with the following test.  Using |  466  * specified [count] times before it continues with the following test.  Using | 
|  467  * [_expectAsync] will also ensure that errors that occur within [callback] are |  467  * [_expectAsync] will also ensure that errors that occur within [callback] are | 
|  468  * tracked and reported. [callback] should take between 0 and 4 positional |  468  * tracked and reported. [callback] should take between 0 and 4 positional | 
|  469  * arguments (named arguments are not supported here). |  469  * arguments (named arguments are not supported here). | 
|  470  */ |  470  */ | 
|  471 Function _expectAsync(Function callback, [int count = 1]) { |  471 Function _expectAsync(Function callback, {int count: 1}) { | 
|  472   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke; |  472   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke; | 
|  473 } |  473 } | 
|  474  |  474  | 
|  475 /** |  475 /** | 
|  476  * Indicate that [callback] is expected to be called a [count] number of times |  476  * Indicate that [callback] is expected to be called a [count] number of times | 
|  477  * (by default 1). The unittest framework will wait for the callback to run the |  477  * (by default 1). The unittest framework will wait for the callback to run the | 
|  478  * specified [count] times before it continues with the following test.  Using |  478  * specified [count] times before it continues with the following test.  Using | 
|  479  * [expectAsync0] will also ensure that errors that occur within [callback] are |  479  * [expectAsync0] will also ensure that errors that occur within [callback] are | 
|  480  * tracked and reported. [callback] should take 0 positional arguments (named |  480  * tracked and reported. [callback] should take 0 positional arguments (named | 
|  481  * arguments are not supported). |  481  * arguments are not supported). | 
|  482  */ |  482  */ | 
|  483 // TODO(sigmund): deprecate this API when issue 2706 is fixed. |  483 // TODO(sigmund): deprecate this API when issue 2706 is fixed. | 
|  484 Function expectAsync0(Function callback, [int count = 1]) { |  484 Function expectAsync0(Function callback, {int count: 1}) { | 
|  485   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke0; |  485   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke0; | 
|  486 } |  486 } | 
|  487  |  487  | 
|  488 /** Like [expectAsync0] but [callback] should take 1 positional argument. */ |  488 /** Like [expectAsync0] but [callback] should take 1 positional argument. */ | 
|  489 // TODO(sigmund): deprecate this API when issue 2706 is fixed. |  489 // TODO(sigmund): deprecate this API when issue 2706 is fixed. | 
|  490 Function expectAsync1(Function callback, {int count: 1}) { |  490 Function expectAsync1(Function callback, {int count: 1}) { | 
|  491   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke1; |  491   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke1; | 
|  492 } |  492 } | 
|  493  |  493  | 
|  494 /** Like [expectAsync0] but [callback] should take 2 positional arguments. */ |  494 /** Like [expectAsync0] but [callback] should take 2 positional arguments. */ | 
|  495 // TODO(sigmund): deprecate this API when issue 2706 is fixed. |  495 // TODO(sigmund): deprecate this API when issue 2706 is fixed. | 
|  496 Function expectAsync2(Function callback, [int count = 1]) { |  496 Function expectAsync2(Function callback, {int count: 1}) { | 
|  497   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke2; |  497   return new _SpreadArgsHelper.fixedCallCount(callback, count).invoke2; | 
|  498 } |  498 } | 
|  499  |  499  | 
|  500 /** |  500 /** | 
|  501  * Indicate that [callback] is expected to be called until [isDone] returns |  501  * Indicate that [callback] is expected to be called until [isDone] returns | 
|  502  * true. The unittest framework checks [isDone] after each callback and only |  502  * true. The unittest framework checks [isDone] after each callback and only | 
|  503  * when it returns true will it continue with the following test. Using |  503  * when it returns true will it continue with the following test. Using | 
|  504  * [expectAsyncUntil] will also ensure that errors that occur within |  504  * [expectAsyncUntil] will also ensure that errors that occur within | 
|  505  * [callback] are tracked and reported. [callback] should take between 0 and |  505  * [callback] are tracked and reported. [callback] should take between 0 and | 
|  506  * 4 positional arguments (named arguments are not supported). |  506  * 4 positional arguments (named arguments are not supported). | 
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  901 } |  901 } | 
|  902  |  902  | 
|  903 /** Enable a test by ID. */ |  903 /** Enable a test by ID. */ | 
|  904 void enableTest(int testId) => _setTestEnabledState(testId, true); |  904 void enableTest(int testId) => _setTestEnabledState(testId, true); | 
|  905  |  905  | 
|  906 /** Disable a test by ID. */ |  906 /** Disable a test by ID. */ | 
|  907 void disableTest(int testId) => _setTestEnabledState(testId, false); |  907 void disableTest(int testId) => _setTestEnabledState(testId, false); | 
|  908  |  908  | 
|  909 /** Signature for a test function. */ |  909 /** Signature for a test function. */ | 
|  910 typedef void TestFunction(); |  910 typedef void TestFunction(); | 
| OLD | NEW |