Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: tests/corelib/list_to_string_test.dart

Issue 13855004: Add default implementation of toString for ListMixin. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/collection/list.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/list.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698