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

Side by Side Diff: lib/core/expect.dart

Issue 11267018: Make getKeys, getValues getters (keys, values). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month 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 | « lib/compiler/implementation/types/concrete_types_inferrer.dart ('k') | lib/core/map.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 /** 5 /**
6 * Expect is used for tests that do not want to make use of the 6 * Expect is used for tests that do not want to make use of the
7 * Dart unit test library - for example, the core language tests. 7 * Dart unit test library - for example, the core language tests.
8 * Third parties are discouraged from using this, and should use 8 * Third parties are discouraged from using this, and should use
9 * the expect() function in the unit test library instead for 9 * the expect() function in the unit test library instead for
10 * test assertions. 10 * test assertions.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 /** 125 /**
126 * Checks that all [expected] and [actual] have the same set of keys (using 126 * Checks that all [expected] and [actual] have the same set of keys (using
127 * the semantics of [Map.containsKey] to determine what "same" means. For 127 * the semantics of [Map.containsKey] to determine what "same" means. For
128 * each key, checks that the values in both maps are equal using `==`. 128 * each key, checks that the values in both maps are equal using `==`.
129 */ 129 */
130 static void mapEquals(Map expected, Map actual, [String reason = null]) { 130 static void mapEquals(Map expected, Map actual, [String reason = null]) {
131 String msg = _getMessage(reason); 131 String msg = _getMessage(reason);
132 132
133 // Make sure all of the values are present in both and match. 133 // Make sure all of the values are present in both and match.
134 for (final key in expected.getKeys()) { 134 for (final key in expected.keys) {
135 if (!actual.containsKey(key)) { 135 if (!actual.containsKey(key)) {
136 _fail('Expect.mapEquals(missing expected key: <$key>$msg) fails'); 136 _fail('Expect.mapEquals(missing expected key: <$key>$msg) fails');
137 } 137 }
138 138
139 Expect.equals(expected[key], actual[key]); 139 Expect.equals(expected[key], actual[key]);
140 } 140 }
141 141
142 // Make sure the actual map doesn't have any extra keys. 142 // Make sure the actual map doesn't have any extra keys.
143 for (final key in actual.getKeys()) { 143 for (final key in actual.keys) {
144 if (!expected.containsKey(key)) { 144 if (!expected.containsKey(key)) {
145 _fail('Expect.mapEquals(unexpected key: <$key>$msg) fails'); 145 _fail('Expect.mapEquals(unexpected key: <$key>$msg) fails');
146 } 146 }
147 } 147 }
148 } 148 }
149 149
150 /** 150 /**
151 * Specialized equality test for strings. When the strings don't match, 151 * Specialized equality test for strings. When the strings don't match,
152 * this method shows where the mismatch starts and ends. 152 * this method shows where the mismatch starts and ends.
153 */ 153 */
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 } 283 }
284 284
285 typedef bool _CheckExceptionFn(exception); 285 typedef bool _CheckExceptionFn(exception);
286 286
287 class ExpectException implements Exception { 287 class ExpectException implements Exception {
288 ExpectException(this.message); 288 ExpectException(this.message);
289 String toString() => message; 289 String toString() => message;
290 String message; 290 String message;
291 } 291 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/types/concrete_types_inferrer.dart ('k') | lib/core/map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698