| OLD | NEW |
| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.keys.length, 2); | 215 assertEquals(d.keys.length, 2); |
| 216 assertEquals(d.values.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.keys, ['a']); | 220 assertEquals(d.keys.single, 'a'); |
| 221 assertEquals(d.values, [1]); | 221 assertEquals(d.values.single, 1); |
| 222 | 222 |
| 223 d['c'] = 3; | 223 d['c'] = 3; |
| 224 d['f'] = 4; | 224 d['f'] = 4; |
| 225 assertEquals(d.keys.length, 3); | 225 assertEquals(d.keys.length, 3); |
| 226 assertEquals(d.values.length, 3); | 226 assertEquals(d.values.length, 3); |
| 227 assertEquals(d.keys, ['a', 'c', 'f']); | 227 assertEquals(d.keys.toList(), ['a', 'c', 'f']); |
| 228 assertEquals(d.values, [1, 3, 4]); | 228 assertEquals(d.values.toList(), [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); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 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 } |
| OLD | NEW |