| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 import 'dart:collection'; |
| 7 |
| 8 class MyList extends ListBase { |
| 9 final list; |
| 10 MyList(this.list); |
| 11 |
| 12 get length => list.length; |
| 13 set length(val) { list.length = val; } |
| 14 |
| 15 operator [](index) => list[index]; |
| 16 operator []=(index, val) => list[index] = val; |
| 17 } |
| 18 |
| 19 main() { |
| 20 Expect.equals("[]", [].toString()); |
| 21 Expect.equals("[1]", [1].toString()); |
| 22 Expect.equals("[1, 2]", [1, 2].toString()); |
| 23 Expect.equals("[]", const [].toString()); |
| 24 Expect.equals("[1]", const [1].toString()); |
| 25 Expect.equals("[1, 2]", const [1, 2].toString()); |
| 26 Expect.equals("[]", new MyList([]).toString()); |
| 27 Expect.equals("[1]", new MyList([1]).toString()); |
| 28 Expect.equals("[1, 2]", new MyList([1, 2]).toString()); |
| 29 } |
| OLD | NEW |