| OLD | NEW |
| 1 library TestUtils; | 1 library TestUtils; |
| 2 import 'dart:async'; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 3 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 | 4 |
| 4 /** | 5 /** |
| 5 * Verifies that [actual] has the same graph structure as [expected]. | 6 * Verifies that [actual] has the same graph structure as [expected]. |
| 6 * Detects cycles and DAG structure in Maps and Lists. | 7 * Detects cycles and DAG structure in Maps and Lists. |
| 7 */ | 8 */ |
| 8 verifyGraph(expected, actual) { | 9 verifyGraph(expected, actual) { |
| 9 var eItems = []; | 10 var eItems = []; |
| 10 var aItems = []; | 11 var aItems = []; |
| 11 | 12 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 62 } |
| 62 } | 63 } |
| 63 return; | 64 return; |
| 64 } | 65 } |
| 65 | 66 |
| 66 expect(false, isTrue, reason: 'Unhandled type: $expected'); | 67 expect(false, isTrue, reason: 'Unhandled type: $expected'); |
| 67 } | 68 } |
| 68 | 69 |
| 69 walk('', expected, actual); | 70 walk('', expected, actual); |
| 70 } | 71 } |
| 72 |
| 73 void futureTest(spec, Future body()) { |
| 74 test(spec, () { |
| 75 expect(body(), completes); |
| 76 }); |
| 77 } |
| 78 |
| 79 /** |
| 80 * Executes an array of test functions which return futures in parallel. |
| 81 * |
| 82 * This returns a future result of the last function. |
| 83 */ |
| 84 Future chainSteps(List<Function> steps) { |
| 85 var future = steps[0](null); |
| 86 for (var step in steps.skip(1)) { |
| 87 future = future.then(step); |
| 88 } |
| 89 return future; |
| 90 } |
| OLD | NEW |