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

Side by Side Diff: tests/language_strong/compile_time_constant_b_test.dart

Issue 2994383002: Migrating block 50, first commit, after tool has run (Closed)
Patch Set: formatting Created 3 years, 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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
7 const m1 = const {'__proto__': 400 + 99};
8 const m2 = const {'a': 499, 'b': 42};
9 const m3 = const {'__proto__': 499};
10
11 bool isUnsupportedError(o) => o is UnsupportedError;
12
13 main() {
14 Expect.equals(499, m1['__proto__']);
15 Expect.equals(null, m1['b']);
16 Expect.listEquals(['__proto__'], m1.keys.toList());
17 Expect.listEquals([499], m1.values.toList());
18 Expect.isTrue(m1.containsKey('__proto__'));
19 Expect.isFalse(m1.containsKey('toString'));
20 Expect.isTrue(m1.containsValue(499));
21 Expect.isFalse(m1.containsValue(null));
22 var seenKeys = [];
23 var seenValues = [];
24 m1.forEach((key, value) {
25 seenKeys.add(key);
26 seenValues.add(value);
27 });
28 Expect.listEquals(['__proto__'], seenKeys);
29 Expect.listEquals([499], seenValues);
30 Expect.isFalse(m1.isEmpty);
31 Expect.equals(1, m1.length);
32 Expect.throws(() => m1.remove('__proto__'), isUnsupportedError);
33 Expect.throws(() => m1.remove('b'), isUnsupportedError);
34 Expect.throws(() => m1.clear(), isUnsupportedError);
35 Expect.throws(() => m1['b'] = 42, isUnsupportedError);
36 Expect.throws(() => m1['__proto__'] = 499, isUnsupportedError);
37 Expect.throws(
38 () => m1.putIfAbsent('__proto__', () => 499), isUnsupportedError);
39 Expect.throws(() => m1.putIfAbsent('z', () => 499), isUnsupportedError);
40
41 Expect.equals(499, m2['a']);
42 Expect.equals(42, m2['b']);
43 Expect.equals(null, m2['c']);
44 Expect.equals(null, m2['__proto__']);
45 Expect.listEquals(['a', 'b'], m2.keys.toList());
46 Expect.listEquals([499, 42], m2.values.toList());
47 Expect.isTrue(m2.containsKey('a'));
48 Expect.isTrue(m2.containsKey('b'));
49 Expect.isFalse(m2.containsKey('toString'));
50 Expect.isFalse(m2.containsKey('__proto__'));
51 Expect.isTrue(m2.containsValue(499));
52 Expect.isTrue(m2.containsValue(42));
53 Expect.isFalse(m2.containsValue(null));
54 seenKeys = [];
55 seenValues = [];
56 m2.forEach((key, value) {
57 seenKeys.add(key);
58 seenValues.add(value);
59 });
60 Expect.listEquals(['a', 'b'], seenKeys);
61 Expect.listEquals([499, 42], seenValues);
62 Expect.isFalse(m2.isEmpty);
63 Expect.equals(2, m2.length);
64 Expect.throws(() => m2.remove('a'), isUnsupportedError);
65 Expect.throws(() => m2.remove('b'), isUnsupportedError);
66 Expect.throws(() => m2.remove('__proto__'), isUnsupportedError);
67 Expect.throws(() => m2.clear(), isUnsupportedError);
68 Expect.throws(() => m2['a'] = 499, isUnsupportedError);
69 Expect.throws(() => m2['b'] = 42, isUnsupportedError);
70 Expect.throws(() => m2['__proto__'] = 499, isUnsupportedError);
71 Expect.throws(() => m2.putIfAbsent('a', () => 499), isUnsupportedError);
72 Expect.throws(
73 () => m2.putIfAbsent('__proto__', () => 499), isUnsupportedError);
74 Expect.throws(() => m2['a'] = 499, isUnsupportedError);
75
76 Expect.isTrue(identical(m1, m3));
77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698