| 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 * Description text of the current test group. If multiple groups are nested, | 6 * Description text of the current test group. If multiple groups are nested, |
| 7 * this will contain all of their text concatenated. | 7 * this will contain all of their text concatenated. |
| 8 */ | 8 */ |
| 9 String _currentGroup = ''; | 9 String _currentGroup = ''; |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 final testCase = new TestCase( | 73 final testCase = new TestCase( |
| 74 _tests.length + 1, _fullSpec(spec), body, callbacks); | 74 _tests.length + 1, _fullSpec(spec), body, callbacks); |
| 75 _tests.add(testCase); | 75 _tests.add(testCase); |
| 76 | 76 |
| 77 if (callbacks < 1) { | 77 if (callbacks < 1) { |
| 78 testCase.error( | 78 testCase.error( |
| 79 'Async tests must wait for at least one callback ', ''); | 79 'Async tests must wait for at least one callback ', ''); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 void serialInvokeAsync(List closures) { |
| 84 final length = closures.length; |
| 85 if (length > 0) { |
| 86 int i = 0; |
| 87 void invokeNext() { |
| 88 closures[i](); |
| 89 i++; |
| 90 if (i < length) { |
| 91 window.setTimeout(invokeNext, 0); |
| 92 } |
| 93 } |
| 94 window.setTimeout(invokeNext, 0); |
| 95 } |
| 96 } |
| 97 |
| 83 /** | 98 /** |
| 84 * Creates a new named group of tests. Calls to group() or test() within the | 99 * Creates a new named group of tests. Calls to group() or test() within the |
| 85 * body of the function passed to this will inherit this group's description. | 100 * body of the function passed to this will inherit this group's description. |
| 86 */ | 101 */ |
| 87 void group(String description, void body()) { | 102 void group(String description, void body()) { |
| 88 _ensureInitialized(); | 103 _ensureInitialized(); |
| 89 | 104 |
| 90 // Concatenate the new group. | 105 // Concatenate the new group. |
| 91 final oldGroup = _currentGroup; | 106 final oldGroup = _currentGroup; |
| 92 if (_currentGroup != '') { | 107 if (_currentGroup != '') { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 344 } |
| 330 | 345 |
| 331 void error(String message, String stackTrace) { | 346 void error(String message, String stackTrace) { |
| 332 result = _ERROR; | 347 result = _ERROR; |
| 333 this.message = message; | 348 this.message = message; |
| 334 this.stackTrace = stackTrace; | 349 this.stackTrace = stackTrace; |
| 335 } | 350 } |
| 336 } | 351 } |
| 337 | 352 |
| 338 typedef void TestFunction(); | 353 typedef void TestFunction(); |
| OLD | NEW |