| OLD | NEW |
| 1 part of unittest; | 1 part of unittest; |
| 2 | 2 |
| 3 /** Simulates spread arguments using named arguments. */ | 3 /** Simulates spread arguments using named arguments. */ |
| 4 // TODO(sigmund): remove this class and simply use a closure with named | 4 // TODO(sigmund): remove this class and simply use a closure with named |
| 5 // arguments (if still applicable). | 5 // arguments (if still applicable). |
| 6 class _SpreadArgsHelper { | 6 class _SpreadArgsHelper { |
| 7 final Function callback; | 7 final Function callback; |
| 8 final int minExpectedCalls; | 8 final int minExpectedCalls; |
| 9 final int maxExpectedCalls; | 9 final int maxExpectedCalls; |
| 10 final Function isDone; | 10 final Function isDone; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 invoke2(arg1, arg2) { | 113 invoke2(arg1, arg2) { |
| 114 return _guardAsync( | 114 return _guardAsync( |
| 115 () { | 115 () { |
| 116 if (shouldCallBack()) { | 116 if (shouldCallBack()) { |
| 117 return callback(arg1, arg2); | 117 return callback(arg1, arg2); |
| 118 } | 118 } |
| 119 }, | 119 }, |
| 120 after, testCase); | 120 after, testCase); |
| 121 } | 121 } |
| 122 |
| 123 _guardAsync(Function tryBody, Function finallyBody, TestCase testCase) { |
| 124 assert(testCase != null); |
| 125 try { |
| 126 return tryBody(); |
| 127 } catch (e, trace) { |
| 128 _registerException(testCase, e, trace); |
| 129 } finally { |
| 130 if (finallyBody != null) finallyBody(); |
| 131 } |
| 132 } |
| 122 } | 133 } |
| OLD | NEW |