| 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 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 bool checkedMode = false; | 9 bool checkedMode = false; |
| 10 assert(checkedMode = true); | 10 assert((checkedMode = true)); |
| 11 void test(expectedList, generatedIterable) { | 11 void test(expectedList, generatedIterable) { |
| 12 Expect.equals(expectedList.length, generatedIterable.length); | 12 Expect.equals(expectedList.length, generatedIterable.length); |
| 13 Expect.listEquals(expectedList, generatedIterable.toList()); | 13 Expect.listEquals(expectedList, generatedIterable.toList()); |
| 14 } | 14 } |
| 15 test([], new Iterable.generate(0)); | 15 test([], new Iterable.generate(0)); |
| 16 test([0], new Iterable.generate(1)); | 16 test([0], new Iterable.generate(1)); |
| 17 test([0,1,2,3,4], new Iterable.generate(5)); | 17 test([0,1,2,3,4], new Iterable.generate(5)); |
| 18 test(["0","1","2","3","4"], new Iterable.generate(5, (x) => "$x")); | 18 test(["0","1","2","3","4"], new Iterable.generate(5, (x) => "$x")); |
| 19 test([2,3,4,5,6], new Iterable.generate(7).skip(2)); | 19 test([2,3,4,5,6], new Iterable.generate(7).skip(2)); |
| 20 test([0,1,2,3,4], new Iterable.generate(7).take(5)); | 20 test([0,1,2,3,4], new Iterable.generate(7).take(5)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 Expect.isTrue(st is Iterable<String>); | 36 Expect.isTrue(st is Iterable<String>); |
| 37 Expect.isTrue(st.iterator is Iterator<String>); | 37 Expect.isTrue(st.iterator is Iterator<String>); |
| 38 Expect.isFalse(st is Iterable<int>); | 38 Expect.isFalse(st is Iterable<int>); |
| 39 Expect.isFalse(st.iterator is Iterator<int>); | 39 Expect.isFalse(st.iterator is Iterator<int>); |
| 40 test(["0","1","2","3","4"], st); | 40 test(["0","1","2","3","4"], st); |
| 41 | 41 |
| 42 if (checkedMode) { | 42 if (checkedMode) { |
| 43 Expect.throws(() => new Iterable<String>.generate(5)); | 43 Expect.throws(() => new Iterable<String>.generate(5)); |
| 44 } | 44 } |
| 45 } | 45 } |
| OLD | NEW |