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

Side by Side Diff: tests/corelib/core_runtime_types_test.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 | « tests/compiler/dart2js/resolver_test.dart ('k') | tests/corelib/linked_hash_map_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 * A test of simple runtime behavior on numbers, strings and lists with 6 * A test of simple runtime behavior on numbers, strings and lists with
7 * a focus on both correct behavior and runtime errors. 7 * a focus on both correct behavior and runtime errors.
8 * 8 *
9 * This file is written to use minimal type declarations to match a 9 * This file is written to use minimal type declarations to match a
10 * typical dynamic language coding style. 10 * typical dynamic language coding style.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 static testMapMethods() { 218 static testMapMethods() {
219 var d = new Map(); 219 var d = new Map();
220 d['a'] = 1; 220 d['a'] = 1;
221 d['b'] = 2; 221 d['b'] = 2;
222 assertEquals(d.containsValue(2), true); 222 assertEquals(d.containsValue(2), true);
223 assertEquals(d.containsValue(3), false); 223 assertEquals(d.containsValue(3), false);
224 assertEquals(d.containsKey('a'), true); 224 assertEquals(d.containsKey('a'), true);
225 assertEquals(d.containsKey('c'), false); 225 assertEquals(d.containsKey('c'), false);
226 assertEquals(d.getKeys().length, 2); 226 assertEquals(d.keys.length, 2);
227 assertEquals(d.getValues().length, 2); 227 assertEquals(d.values.length, 2);
228 228
229 assertEquals(d.remove('c'), null); 229 assertEquals(d.remove('c'), null);
230 assertEquals(d.remove('b'), 2); 230 assertEquals(d.remove('b'), 2);
231 assertListEquals(d.getKeys(), ['a']); 231 assertListEquals(d.keys, ['a']);
232 assertListEquals(d.getValues(), [1]); 232 assertListEquals(d.values, [1]);
233 233
234 d['c'] = 3; 234 d['c'] = 3;
235 d['f'] = 4; 235 d['f'] = 4;
236 assertEquals(d.getKeys().length, 3); 236 assertEquals(d.keys.length, 3);
237 assertEquals(d.getValues().length, 3); 237 assertEquals(d.values.length, 3);
238 assertListContains(d.getKeys(), ['a', 'c', 'f']); 238 assertListContains(d.keys, ['a', 'c', 'f']);
239 assertListContains(d.getValues(), [1, 3, 4]); 239 assertListContains(d.values, [1, 3, 4]);
240 240
241 var count = 0; 241 var count = 0;
242 d.forEach((key, value) { 242 d.forEach((key, value) {
243 count++; 243 count++;
244 assertEquals(value, d[key]); 244 assertEquals(value, d[key]);
245 }); 245 });
246 assertEquals(count, 3); 246 assertEquals(count, 3);
247 247
248 d = { 'a': 1, 'b': 2 }; 248 d = { 'a': 1, 'b': 2 };
249 assertEquals(d.containsValue(2), true); 249 assertEquals(d.containsValue(2), true);
250 assertEquals(d.containsValue(3), false); 250 assertEquals(d.containsValue(3), false);
251 assertEquals(d.containsKey('a'), true); 251 assertEquals(d.containsKey('a'), true);
252 assertEquals(d.containsKey('c'), false); 252 assertEquals(d.containsKey('c'), false);
253 assertEquals(d.getKeys().length, 2); 253 assertEquals(d.keys.length, 2);
254 assertEquals(d.getValues().length, 2); 254 assertEquals(d.values.length, 2);
255 255
256 d['g'] = null; 256 d['g'] = null;
257 assertEquals(d.containsKey('g'), true); 257 assertEquals(d.containsKey('g'), true);
258 assertEquals(d['g'], null); 258 assertEquals(d['g'], null);
259 } 259 }
260 260
261 static testDateMethods() { 261 static testDateMethods() {
262 var msec = 115201000; 262 var msec = 115201000;
263 var d = new Date.fromMillisecondsSinceEpoch(msec, isUtc: true); 263 var d = new Date.fromMillisecondsSinceEpoch(msec, isUtc: true);
264 assertEquals(d.second, 1); 264 assertEquals(d.second, 1);
(...skipping 16 matching lines...) Expand all
281 '${true}'.toString(); 281 '${true}'.toString();
282 '${false}'.toString(); 282 '${false}'.toString();
283 ''.toString(); 283 ''.toString();
284 ''.endsWith(''); 284 ''.endsWith('');
285 } 285 }
286 } 286 }
287 287
288 main() { 288 main() {
289 CoreRuntimeTypesTest.testMain(); 289 CoreRuntimeTypesTest.testMain();
290 } 290 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/resolver_test.dart ('k') | tests/corelib/linked_hash_map_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698