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

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

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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/html/xmlelement_test.dart ('k') | tests/language/compile_time_constant_b_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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 const m1 = const { 'a': 400 + 99 }; 5 const m1 = const { 'a': 400 + 99 };
6 const m2 = const { 'a': 499, 'b': 42 }; 6 const m2 = const { 'a': 499, 'b': 42 };
7 const m3 = const { 'm1': m1, 'm2': m2 }; 7 const m3 = const { 'm1': m1, 'm2': m2 };
8 const m4 = const { 'z': 9, 'a': 8, 'm': 7 }; 8 const m4 = const { 'z': 9, 'a': 8, 'm': 7 };
9 const m5 = const { '': 499 }; 9 const m5 = const { '': 499 };
10 const m6 = const { 'a': 499 }; 10 const m6 = const { 'a': 499 };
(...skipping 12 matching lines...) Expand all
23 Expect.isFalse(m1.containsValue(42)); 23 Expect.isFalse(m1.containsValue(42));
24 Expect.isFalse(m1.containsValue(null)); 24 Expect.isFalse(m1.containsValue(null));
25 var seenKeys = []; 25 var seenKeys = [];
26 var seenValues = []; 26 var seenValues = [];
27 m1.forEach((key, value) { 27 m1.forEach((key, value) {
28 seenKeys.add(key); 28 seenKeys.add(key);
29 seenValues.add(value); 29 seenValues.add(value);
30 }); 30 });
31 Expect.listEquals(['a'], seenKeys); 31 Expect.listEquals(['a'], seenKeys);
32 Expect.listEquals([499], seenValues); 32 Expect.listEquals([499], seenValues);
33 Expect.isFalse(m1.isEmpty()); 33 Expect.isFalse(m1.isEmpty);
34 Expect.equals(1, m1.length); 34 Expect.equals(1, m1.length);
35 Expect.throws(() => m1.remove('a'), isUnsupportedError); 35 Expect.throws(() => m1.remove('a'), isUnsupportedError);
36 Expect.throws(() => m1.remove('b'), isUnsupportedError); 36 Expect.throws(() => m1.remove('b'), isUnsupportedError);
37 Expect.throws(() => m1.clear(), isUnsupportedError); 37 Expect.throws(() => m1.clear(), isUnsupportedError);
38 Expect.throws(() => m1['b'] = 42, isUnsupportedError); 38 Expect.throws(() => m1['b'] = 42, isUnsupportedError);
39 Expect.throws(() => m1['a'] = 499, isUnsupportedError); 39 Expect.throws(() => m1['a'] = 499, isUnsupportedError);
40 Expect.throws(() => m1.putIfAbsent('a', () => 499), isUnsupportedError); 40 Expect.throws(() => m1.putIfAbsent('a', () => 499), isUnsupportedError);
41 Expect.throws(() => m1.putIfAbsent('z', () => 499), isUnsupportedError); 41 Expect.throws(() => m1.putIfAbsent('z', () => 499), isUnsupportedError);
42 42
43 Expect.equals(499, m2['a']); 43 Expect.equals(499, m2['a']);
44 Expect.equals(42, m2['b']); 44 Expect.equals(42, m2['b']);
45 Expect.equals(null, m2['c']); 45 Expect.equals(null, m2['c']);
46 Expect.listEquals(['a', 'b'], m2.getKeys()); 46 Expect.listEquals(['a', 'b'], m2.getKeys());
47 Expect.listEquals([499, 42], m2.getValues()); 47 Expect.listEquals([499, 42], m2.getValues());
48 Expect.isTrue(m2.containsKey('a')); 48 Expect.isTrue(m2.containsKey('a'));
49 Expect.isTrue(m2.containsKey('b')); 49 Expect.isTrue(m2.containsKey('b'));
50 Expect.isFalse(m2.containsKey('toString')); 50 Expect.isFalse(m2.containsKey('toString'));
51 Expect.isTrue(m2.containsValue(499)); 51 Expect.isTrue(m2.containsValue(499));
52 Expect.isTrue(m2.containsValue(42)); 52 Expect.isTrue(m2.containsValue(42));
53 Expect.isFalse(m2.containsValue(99)); 53 Expect.isFalse(m2.containsValue(99));
54 Expect.isFalse(m2.containsValue(null)); 54 Expect.isFalse(m2.containsValue(null));
55 seenKeys = []; 55 seenKeys = [];
56 seenValues = []; 56 seenValues = [];
57 m2.forEach((key, value) { 57 m2.forEach((key, value) {
58 seenKeys.add(key); 58 seenKeys.add(key);
59 seenValues.add(value); 59 seenValues.add(value);
60 }); 60 });
61 Expect.listEquals(['a', 'b'], seenKeys); 61 Expect.listEquals(['a', 'b'], seenKeys);
62 Expect.listEquals([499, 42], seenValues); 62 Expect.listEquals([499, 42], seenValues);
63 Expect.isFalse(m2.isEmpty()); 63 Expect.isFalse(m2.isEmpty);
64 Expect.equals(2, m2.length); 64 Expect.equals(2, m2.length);
65 Expect.throws(() => m2.remove('a'), isUnsupportedError); 65 Expect.throws(() => m2.remove('a'), isUnsupportedError);
66 Expect.throws(() => m2.remove('b'), isUnsupportedError); 66 Expect.throws(() => m2.remove('b'), isUnsupportedError);
67 Expect.throws(() => m2.remove('c'), isUnsupportedError); 67 Expect.throws(() => m2.remove('c'), isUnsupportedError);
68 Expect.throws(() => m2.clear(), isUnsupportedError); 68 Expect.throws(() => m2.clear(), isUnsupportedError);
69 Expect.throws(() => m2['a'] = 499, isUnsupportedError); 69 Expect.throws(() => m2['a'] = 499, isUnsupportedError);
70 Expect.throws(() => m2['b'] = 42, isUnsupportedError); 70 Expect.throws(() => m2['b'] = 42, isUnsupportedError);
71 Expect.throws(() => m2['c'] = 499, isUnsupportedError); 71 Expect.throws(() => m2['c'] = 499, isUnsupportedError);
72 Expect.throws(() => m2.putIfAbsent('a', () => 499), isUnsupportedError); 72 Expect.throws(() => m2.putIfAbsent('a', () => 499), isUnsupportedError);
73 Expect.throws(() => m2.putIfAbsent('z', () => 499), isUnsupportedError); 73 Expect.throws(() => m2.putIfAbsent('z', () => 499), isUnsupportedError);
(...skipping 12 matching lines...) Expand all
86 }); 86 });
87 Expect.listEquals(['z', 'a', 'm'], seenKeys); 87 Expect.listEquals(['z', 'a', 'm'], seenKeys);
88 Expect.listEquals([9, 8, 7], seenValues); 88 Expect.listEquals([9, 8, 7], seenValues);
89 89
90 Expect.equals(499, m5['']); 90 Expect.equals(499, m5['']);
91 Expect.isTrue(m5.containsKey('')); 91 Expect.isTrue(m5.containsKey(''));
92 Expect.equals(1, m5.length); 92 Expect.equals(1, m5.length);
93 93
94 Expect.isTrue(m1 === m6); 94 Expect.isTrue(m1 === m6);
95 95
96 Expect.isTrue(m7.isEmpty()); 96 Expect.isTrue(m7.isEmpty);
97 Expect.equals(0, m7.length); 97 Expect.equals(0, m7.length);
98 Expect.equals(null, m7['b']); 98 Expect.equals(null, m7['b']);
99 Expect.listEquals([], m7.getKeys()); 99 Expect.listEquals([], m7.getKeys());
100 Expect.listEquals([], m7.getValues()); 100 Expect.listEquals([], m7.getValues());
101 Expect.isFalse(m7.containsKey('a')); 101 Expect.isFalse(m7.containsKey('a'));
102 Expect.isFalse(m7.containsKey('toString')); 102 Expect.isFalse(m7.containsKey('toString'));
103 Expect.isFalse(m7.containsValue(499)); 103 Expect.isFalse(m7.containsValue(499));
104 Expect.isFalse(m7.containsValue(null)); 104 Expect.isFalse(m7.containsValue(null));
105 seenKeys = []; 105 seenKeys = [];
106 seenValues = []; 106 seenValues = [];
107 m7.forEach((key, value) { 107 m7.forEach((key, value) {
108 seenKeys.add(key); 108 seenKeys.add(key);
109 seenValues.add(value); 109 seenValues.add(value);
110 }); 110 });
111 Expect.listEquals([], seenKeys); 111 Expect.listEquals([], seenKeys);
112 Expect.listEquals([], seenValues); 112 Expect.listEquals([], seenValues);
113 Expect.throws(() => m7.remove('a'), isUnsupportedError); 113 Expect.throws(() => m7.remove('a'), isUnsupportedError);
114 Expect.throws(() => m7.remove('b'), isUnsupportedError); 114 Expect.throws(() => m7.remove('b'), isUnsupportedError);
115 Expect.throws(() => m7.clear(), isUnsupportedError); 115 Expect.throws(() => m7.clear(), isUnsupportedError);
116 Expect.throws(() => m7['b'] = 42, isUnsupportedError); 116 Expect.throws(() => m7['b'] = 42, isUnsupportedError);
117 Expect.throws(() => m7['a'] = 499, isUnsupportedError); 117 Expect.throws(() => m7['a'] = 499, isUnsupportedError);
118 Expect.throws(() => m7.putIfAbsent('a', () => 499), 118 Expect.throws(() => m7.putIfAbsent('a', () => 499),
119 isUnsupportedError); 119 isUnsupportedError);
120 Expect.throws(() => m7.putIfAbsent('z', () => 499), 120 Expect.throws(() => m7.putIfAbsent('z', () => 499),
121 isUnsupportedError); 121 isUnsupportedError);
122 } 122 }
OLDNEW
« no previous file with comments | « tests/html/xmlelement_test.dart ('k') | tests/language/compile_time_constant_b_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698