| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class IC { | 5 class IC { |
| 6 int count = 0; | 6 int count = 0; |
| 7 String toString() => "${count++}"; | 7 String toString() => "${count++}"; |
| 8 } | 8 } |
| 9 | 9 |
| 10 testJoin(String expect, Iterable iterable, [String separator]) { | 10 testJoin(String expect, Iterable iterable, [String separator]) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 testJoin("0,1,2,3,4", array.take(5), ","); | 48 testJoin("0,1,2,3,4", array.take(5), ","); |
| 49 testJoin("0,1,2,3,4", array.takeWhile((i) => i < 5), ","); | 49 testJoin("0,1,2,3,4", array.takeWhile((i) => i < 5), ","); |
| 50 } | 50 } |
| 51 testArray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); | 51 testArray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); |
| 52 var fixedArray = new List.fixedLength(10); | 52 var fixedArray = new List.fixedLength(10); |
| 53 for (int i = 0; i < 10; i++) { | 53 for (int i = 0; i < 10; i++) { |
| 54 fixedArray[i] = i; | 54 fixedArray[i] = i; |
| 55 } | 55 } |
| 56 testArray(fixedArray); | 56 testArray(fixedArray); |
| 57 testArray(const [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); | 57 testArray(const [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); |
| 58 |
| 59 testJoin("a,b,c,d", ["a", "b", "c", "d"].map((x) => x), ","); |
| 60 testJoin("abcd", ["a", "b", "c", "d"].map((x) => x), ""); |
| 61 testJoin("abcd", ["a", "b", "c", "d"].map((x) => x)); |
| 62 testJoin("null,b,c,d", [null,"b","c","d"].map((x) => x), ","); |
| 63 testJoin("1,2,3,4", [1, 2, 3, 4].map((x) => x), ","); |
| 64 testJoin("4,5,6,7", [ic, ic, ic, ic].map((x) => x), ","); |
| 58 } | 65 } |
| 59 | 66 |
| 60 main() { | 67 main() { |
| 61 testCollections(); | 68 testCollections(); |
| 62 // TODO(lrn): test scalar lists. | 69 // TODO(lrn): test scalar lists. |
| 63 } | 70 } |
| OLD | NEW |