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

Side by Side Diff: editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/model/testsource/CoreRuntimeTypesTest.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 | « no previous file | lib/compiler/implementation/closure.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 arrays with 6 * A test of simple runtime behavior on numbers, strings and arrays 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 static testMapMethods() { 207 static testMapMethods() {
208 var d = new Map(); 208 var d = new Map();
209 d['a'] = 1; 209 d['a'] = 1;
210 d['b'] = 2; 210 d['b'] = 2;
211 assertEquals(d.containsValue(2), true); 211 assertEquals(d.containsValue(2), true);
212 assertEquals(d.containsValue(3), false); 212 assertEquals(d.containsValue(3), false);
213 assertEquals(d.containsKey('a'), true); 213 assertEquals(d.containsKey('a'), true);
214 assertEquals(d.containsKey('c'), false); 214 assertEquals(d.containsKey('c'), false);
215 assertEquals(d.getKeys().length, 2); 215 assertEquals(d.keys.length, 2);
216 assertEquals(d.getValues().length, 2); 216 assertEquals(d.values.length, 2);
217 217
218 assertEquals(d.remove('c'), null); 218 assertEquals(d.remove('c'), null);
219 assertEquals(d.remove('b'), 2); 219 assertEquals(d.remove('b'), 2);
220 assertEquals(d.getKeys(), ['a']); 220 assertEquals(d.keys, ['a']);
221 assertEquals(d.getValues(), [1]); 221 assertEquals(d.values, [1]);
222 222
223 d['c'] = 3; 223 d['c'] = 3;
224 d['f'] = 4; 224 d['f'] = 4;
225 assertEquals(d.getKeys().length, 3); 225 assertEquals(d.keys.length, 3);
226 assertEquals(d.getValues().length, 3); 226 assertEquals(d.values.length, 3);
227 assertEquals(d.getKeys(), ['a', 'c', 'f']); 227 assertEquals(d.keys, ['a', 'c', 'f']);
228 assertEquals(d.getValues(), [1, 3, 4]); 228 assertEquals(d.values, [1, 3, 4]);
229 229
230 var count = 0; 230 var count = 0;
231 d.forEach(function(key, value) { 231 d.forEach(function(key, value) {
232 count++; 232 count++;
233 assertEquals(value, d[key]); 233 assertEquals(value, d[key]);
234 }); 234 });
235 assertEquals(count, 3); 235 assertEquals(count, 3);
236 236
237 d = { 'a': 1, 'b': 2 }; 237 d = { 'a': 1, 'b': 2 };
238 assertEquals(d.containsValue(2), true); 238 assertEquals(d.containsValue(2), true);
239 assertEquals(d.containsValue(3), false); 239 assertEquals(d.containsValue(3), false);
240 assertEquals(d.containsKey('a'), true); 240 assertEquals(d.containsKey('a'), true);
241 assertEquals(d.containsKey('c'), false); 241 assertEquals(d.containsKey('c'), false);
242 assertEquals(d.getKeys().length, 2); 242 assertEquals(d.keys.length, 2);
243 assertEquals(d.getValues().length, 2); 243 assertEquals(d.values.length, 2);
244 244
245 d['g'] = null; 245 d['g'] = null;
246 assertEquals(d.containsKey('g'), true); 246 assertEquals(d.containsKey('g'), true);
247 assertEquals(d['g'], null); 247 assertEquals(d['g'], null);
248 } 248 }
249 249
250 static testDateMethods() { 250 static testDateMethods() {
251 // TODO(jimhug): Switch to named constructors when available. 251 // TODO(jimhug): Switch to named constructors when available.
252 // Pushing this into Jan 2nd to make the year independent of timezone. 252 // Pushing this into Jan 2nd to make the year independent of timezone.
253 // TODO(jimhug): Pursue a better solution to TZ issues. 253 // TODO(jimhug): Pursue a better solution to TZ issues.
(...skipping 12 matching lines...) Expand all
266 .5.toString(); 266 .5.toString();
267 1.toString(); 267 1.toString();
268 if (false) { 268 if (false) {
269 null.toString(); 269 null.toString();
270 } 270 }
271 '${1}'.toString(); 271 '${1}'.toString();
272 ''.toString(); 272 ''.toString();
273 ''.endsWith(''); 273 ''.endsWith('');
274 } 274 }
275 } 275 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698