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

Side by Side Diff: tests/language/map_literal10_test.dart

Issue 22909056: Support general expressions as keys in literal maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 3 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 | « tests/language/language_dart2js.status ('k') | tests/language/map_literal11_test.dart » ('j') | 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 // Test the use of '__proto__' keys in maps.
6
7 library map_literal10_test;
8
9 import "package:expect/expect.dart";
10
11 void main() {
12 var m1 = const {"__proto__": 0, 1: 1};
13 Expect.isTrue(m1.containsKey("__proto__"));
14 Expect.equals(0, m1["__proto__"]);
15 Expect.isTrue(m1.containsKey(1));
16 Expect.equals(1, m1[1]);
17 Expect.listEquals(["__proto__", 1], m1.keys.toList());
18
19 var m2 = const {1: 0, "__proto__": 1};
20 Expect.isTrue(m2.containsKey(1));
21 Expect.equals(0, m2[1]);
22 Expect.isTrue(m2.containsKey("__proto__"));
23 Expect.equals(1, m2["__proto__"]);
24 Expect.listEquals([1, "__proto__"], m2.keys.toList());
25
26 var m3 = const {"1": 0, "__proto__": 1};
27 Expect.isTrue(m3.containsKey("1"));
28 Expect.equals(0, m3["1"]);
29 Expect.isTrue(m3.containsKey("__proto__"));
30 Expect.equals(1, m3["__proto__"]);
31 Expect.listEquals(["1", "__proto__"], m3.keys.toList());
32
33 var m4 = const {"__proto__": 1, "1": 2};
34 Expect.isTrue(m4.containsKey("1"));
35 Expect.equals(2, m4["1"]);
36 Expect.isTrue(m4.containsKey("__proto__"));
37 Expect.equals(1, m4["__proto__"]);
38 Expect.listEquals(["__proto__", "1"], m4.keys.toList());
39 }
OLDNEW
« no previous file with comments | « tests/language/language_dart2js.status ('k') | tests/language/map_literal11_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698