| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:collection"; | 6 import "dart:collection"; |
| 7 | 7 |
| 8 test(List list, int start, int end, [fillValue]) { | 8 test(List list, int start, int end, [fillValue]) { |
| 9 List copy = list.toList(); | 9 List copy = list.toList(); |
| 10 if (?fillValue) { | 10 list.fillRange(start, end, fillValue); |
| 11 list.fillRange(start, end, fillValue); | |
| 12 } else { | |
| 13 list.fillRange(start, end, fillValue); | |
| 14 } | |
| 15 Expect.equals(copy.length, list.length); | 11 Expect.equals(copy.length, list.length); |
| 16 for (int i = 0; i < start; i++) { | 12 for (int i = 0; i < start; i++) { |
| 17 Expect.equals(copy[i], list[i]); | 13 Expect.equals(copy[i], list[i]); |
| 18 } | 14 } |
| 19 for (int i = start; i < end; i++) { | 15 for (int i = start; i < end; i++) { |
| 20 Expect.equals(fillValue, list[i]); | 16 Expect.equals(fillValue, list[i]); |
| 21 } | 17 } |
| 22 for (int i = end; i < list.length; i++) { | 18 for (int i = end; i < list.length; i++) { |
| 23 Expect.equals(copy[i], list[i]); | 19 Expect.equals(copy[i], list[i]); |
| 24 } | 20 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 expectUE(() => test(const [1, 2, 3], 1, 4)); | 65 expectUE(() => test(const [1, 2, 3], 1, 4)); |
| 70 } | 66 } |
| 71 | 67 |
| 72 void expectRE(Function f) { | 68 void expectRE(Function f) { |
| 73 Expect.throws(f, (e) => e is RangeError); | 69 Expect.throws(f, (e) => e is RangeError); |
| 74 } | 70 } |
| 75 | 71 |
| 76 void expectUE(Function f) { | 72 void expectUE(Function f) { |
| 77 Expect.throws(f, (e) => e is UnsupportedError); | 73 Expect.throws(f, (e) => e is UnsupportedError); |
| 78 } | 74 } |
| OLD | NEW |