| 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) { | |
| 14 list.length = val; | |
| 15 } | |
| 16 | |
| 17 operator [](index) => list[index]; | |
| 18 operator []=(index, val) => list[index] = val; | |
| 19 } | |
| 20 | |
| 21 main() { | |
| 22 Expect.equals("[]", [].toString()); | |
| 23 Expect.equals("[1]", [1].toString()); | |
| 24 Expect.equals("[1, 2]", [1, 2].toString()); | |
| 25 Expect.equals("[]", const [].toString()); | |
| 26 Expect.equals("[1]", const [1].toString()); | |
| 27 Expect.equals("[1, 2]", const [1, 2].toString()); | |
| 28 Expect.equals("[]", new MyList([]).toString()); | |
| 29 Expect.equals("[1]", new MyList([1]).toString()); | |
| 30 Expect.equals("[1, 2]", new MyList([1, 2]).toString()); | |
| 31 } | |
| OLD | NEW |