| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "dart:collection"; | 5 import "dart:collection"; |
| 6 import "package:collection/iterable_zip.dart"; | 6 |
| 7 import "package:test/test.dart"; | 7 import "package:test/test.dart"; |
| 8 | 8 |
| 9 import "package:collection/collection.dart"; |
| 10 |
| 9 /// Iterable like [base] except that it throws when value equals [errorValue]. | 11 /// Iterable like [base] except that it throws when value equals [errorValue]. |
| 10 Iterable iterError(Iterable base, int errorValue) { | 12 Iterable iterError(Iterable base, int errorValue) { |
| 11 return base.map((x) => x == errorValue ? throw "BAD" : x); | 13 return base.map((x) => x == errorValue ? throw "BAD" : x); |
| 12 } | 14 } |
| 13 | 15 |
| 14 main() { | 16 main() { |
| 15 test("Basic", () { | 17 test("Basic", () { |
| 16 expect(new IterableZip([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), | 18 expect(new IterableZip([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), |
| 17 equals([[1, 4, 7], [2, 5, 8], [3, 6, 9]])); | 19 equals([[1, 4, 7], [2, 5, 8], [3, 6, 9]])); |
| 18 }); | 20 }); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 throwsA(equals("BAD"))); | 105 throwsA(equals("BAD"))); |
| 104 }); | 106 }); |
| 105 | 107 |
| 106 test("Error after first end", () { | 108 test("Error after first end", () { |
| 107 expect(new IterableZip([[1, 2, 3], | 109 expect(new IterableZip([[1, 2, 3], |
| 108 [4, 5, 6], | 110 [4, 5, 6], |
| 109 iterError([7, 8, 9, 10], 10)]), | 111 iterError([7, 8, 9, 10], 10)]), |
| 110 equals([[1, 4, 7], [2, 5, 8], [3, 6, 9]])); | 112 equals([[1, 4, 7], [2, 5, 8], [3, 6, 9]])); |
| 111 }); | 113 }); |
| 112 } | 114 } |
| OLD | NEW |