Chromium Code Reviews| 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](); | |
| 86 for (var step in steps.skip(1)) { | |
| 87 future = future.then( | |
| 88 (value) { | |
| 89 var result; | |
| 90 guardAsync(() { | |
|
nweiz
2013/02/05 02:03:19
guardAsync shouldn't be necessary if you're using
blois
2013/02/05 03:02:42
The error messages that I get from exceptions thro
nweiz
2013/02/05 03:05:39
How so? What's different about it?
blois
2013/02/06 23:34:13
Resolution: issues unrelated to this code (unclose
| |
| 91 result = step(value); | |
| 92 }); | |
| 93 return result; | |
| 94 }); | |
| 95 } | |
| 96 return future; | |
| 97 } | |
| OLD | NEW |