| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test program for testing arrays. | 4 // Dart test program for testing arrays. |
| 5 | 5 |
| 6 class ListTest { | 6 class ListTest { |
| 7 static void TestIterator() { | 7 static void TestIterator() { |
| 8 List<int> a = new List<int>(10); | 8 List<int> a = new List<int>(10); |
| 9 int count = 0; | 9 int count = 0; |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 Expect.equals(1, a[1]); | 50 Expect.equals(1, a[1]); |
| 51 Expect.throws(() => a[len], (e) => e is RangeError); | 51 Expect.throws(() => a[len], (e) => e is RangeError); |
| 52 | 52 |
| 53 Expect.throws(() { | 53 Expect.throws(() { |
| 54 List a = new List(4); | 54 List a = new List(4); |
| 55 a.setRange(1, 1, a, null); | 55 a.setRange(1, 1, a, null); |
| 56 }); | 56 }); |
| 57 | 57 |
| 58 Expect.throws(() { | 58 Expect.throws(() { |
| 59 List a = new List(4); | 59 List a = new List(4); |
| 60 a.setRange(1, 1, const [1, 2, 3, 4], null); |
| 61 }); |
| 62 |
| 63 Expect.throws(() { |
| 64 List a = new List(4); |
| 60 a.setRange(10, 1, a, 1); | 65 a.setRange(10, 1, a, 1); |
| 61 }, (e) => e is RangeError); | 66 }, (e) => e is RangeError); |
| 62 | 67 |
| 63 a = new List(4); | 68 a = new List(4); |
| 64 List b = new List(4); | 69 List b = new List(4); |
| 65 b.setRange(0, 4, a, 0); | 70 b.setRange(0, 4, a, 0); |
| 66 | 71 |
| 67 List<int> unsorted = [4, 3, 9, 12, -4, 9]; | 72 List<int> unsorted = [4, 3, 9, 12, -4, 9]; |
| 68 int compare(a, b) { | 73 int compare(a, b) { |
| 69 if (a < b) return -1; | 74 if (a < b) return -1; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // We cannot write just 'list.removeLast' due to issue 3769. | 107 // We cannot write just 'list.removeLast' due to issue 3769. |
| 103 Expect.throws(() => list.removeLast(), | 108 Expect.throws(() => list.removeLast(), |
| 104 (e) => e is RangeError); | 109 (e) => e is RangeError); |
| 105 Expect.equals(0, list.length); | 110 Expect.equals(0, list.length); |
| 106 } | 111 } |
| 107 } | 112 } |
| 108 | 113 |
| 109 main() { | 114 main() { |
| 110 ListTest.testMain(); | 115 ListTest.testMain(); |
| 111 } | 116 } |
| OLD | NEW |