| 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 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 assertEquals(d.keys.length, 2); | 246 assertEquals(d.keys.length, 2); |
| 247 assertEquals(d.values.length, 2); | 247 assertEquals(d.values.length, 2); |
| 248 | 248 |
| 249 d['g'] = null; | 249 d['g'] = null; |
| 250 assertEquals(d.containsKey('g'), true); | 250 assertEquals(d.containsKey('g'), true); |
| 251 assertEquals(d['g'], null); | 251 assertEquals(d['g'], null); |
| 252 } | 252 } |
| 253 | 253 |
| 254 static testDateMethods() { | 254 static testDateMethods() { |
| 255 var msec = 115201000; | 255 var msec = 115201000; |
| 256 var d = new Date.fromMillisecondsSinceEpoch(msec, isUtc: true); | 256 var d = new DateTime.fromMillisecondsSinceEpoch(msec, isUtc: true); |
| 257 assertEquals(d.second, 1); | 257 assertEquals(d.second, 1); |
| 258 assertEquals(d.year, 1970); | 258 assertEquals(d.year, 1970); |
| 259 | 259 |
| 260 d = new Date.now(); | 260 d = new DateTime.now(); |
| 261 assertEquals(d.year >= 2011, true); | 261 assertEquals(d.year >= 2011, true); |
| 262 } | 262 } |
| 263 | 263 |
| 264 static testLiterals() { | 264 static testLiterals() { |
| 265 true.toString(); | 265 true.toString(); |
| 266 1.0.toString(); | 266 1.0.toString(); |
| 267 .5.toString(); | 267 .5.toString(); |
| 268 1.toString(); | 268 1.toString(); |
| 269 if (false) { | 269 if (false) { |
| 270 // Depends on http://b/4198808. | 270 // Depends on http://b/4198808. |
| 271 null.toString(); | 271 null.toString(); |
| 272 } | 272 } |
| 273 '${null}'.toString(); | 273 '${null}'.toString(); |
| 274 '${true}'.toString(); | 274 '${true}'.toString(); |
| 275 '${false}'.toString(); | 275 '${false}'.toString(); |
| 276 ''.toString(); | 276 ''.toString(); |
| 277 ''.endsWith(''); | 277 ''.endsWith(''); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 main() { | 281 main() { |
| 282 CoreRuntimeTypesTest.testMain(); | 282 CoreRuntimeTypesTest.testMain(); |
| 283 } | 283 } |
| OLD | NEW |