| Index: tests/corelib/list_insert_at_test.dart
|
| diff --git a/tests/corelib/list_removeat_test.dart b/tests/corelib/list_insert_at_test.dart
|
| similarity index 57%
|
| copy from tests/corelib/list_removeat_test.dart
|
| copy to tests/corelib/list_insert_at_test.dart
|
| index d6a9b28bcef238f8b932799636bf0c49ba76765a..e186126c4fe1c19e1f9094a1b2a652286aa4a80c 100644
|
| --- a/tests/corelib/list_removeat_test.dart
|
| +++ b/tests/corelib/list_insert_at_test.dart
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| @@ -10,53 +10,50 @@ void main() {
|
| assert(checkedMode = true);
|
|
|
| // Index must be integer and in range.
|
| - Expect.throws(() { l1.removeAt(-1); },
|
| + Expect.throws(() { l1.insertAt(-1, 5); },
|
| (e) => e is RangeError,
|
| "negative");
|
| - Expect.throws(() { l1.removeAt(5); },
|
| + Expect.throws(() { l1.insertAt(6, 5); },
|
| (e) => e is RangeError,
|
| "too large");
|
| - Expect.throws(() { l1.removeAt(null); },
|
| + Expect.throws(() { l1.insertAt(null, 5); },
|
| (e) => e is ArgumentError,
|
| "too large");
|
| - Expect.throws(() { l1.removeAt("1"); },
|
| + Expect.throws(() { l1.insertAt("1", 5); },
|
| (e) => (checkedMode ? e is TypeError
|
| : e is ArgumentError),
|
| "string");
|
| - Expect.throws(() { l1.removeAt(1.5); },
|
| + Expect.throws(() { l1.insertAt(1.5, 5); },
|
| (e) => (checkedMode ? e is TypeError
|
| : e is ArgumentError),
|
| "double");
|
|
|
| - Expect.equals(2, l1.removeAt(2), "l1-remove2");
|
| - Expect.equals(1, l1[1], "l1-1[1]");
|
| + l1.insertAt(5, 5);
|
| + Expect.equals(6, l1.length);
|
| + Expect.equals(5, l1[5]);
|
| + Expect.equals("[0, 1, 2, 3, 4, 5]", l1.toString());
|
|
|
| - Expect.equals(3, l1[2], "l1-1[2]");
|
| - Expect.equals(4, l1[3], "l1-1[3]");
|
| - Expect.equals(4, l1.length, "length-1");
|
| -
|
| - Expect.equals(0, l1.removeAt(0), "l1-remove0");
|
| - Expect.equals(1, l1[0], "l1-2[0]");
|
| - Expect.equals(3, l1[1], "l1-2[1]");
|
| - Expect.equals(4, l1[2], "l1-2[2]");
|
| - Expect.equals(3, l1.length, "length-2");
|
| + l1.insertAt(0, -1);
|
| + Expect.equals(7, l1.length);
|
| + Expect.equals(-1, l1[0]);
|
| + Expect.equals("[-1, 0, 1, 2, 3, 4, 5]", l1.toString());
|
|
|
| // Fixed size list.
|
| var l2 = new List(5);
|
| for (var i = 0; i < 5; i++) l2[i] = i;
|
| - Expect.throws(() { l2.removeAt(2); },
|
| + Expect.throws(() { l2.insertAt(2, 5); },
|
| (e) => e is UnsupportedError,
|
| "fixed-length");
|
|
|
| // Unmodifiable list.
|
| var l3 = const [0, 1, 2, 3, 4];
|
| - Expect.throws(() { l3.removeAt(2); },
|
| + Expect.throws(() { l3.insertAt(2, 5); },
|
| (e) => e is UnsupportedError,
|
| "unmodifiable");
|
|
|
| // Empty list is not special.
|
| var l4 = [];
|
| - Expect.throws(() { l4.removeAt(0); },
|
| - (e) => e is RangeError,
|
| - "empty");
|
| + l4.insertAt(0, 499);
|
| + Expect.equals(1, l4.length);
|
| + Expect.equals(499, l4[0]);
|
| }
|
|
|