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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 assertListEquals(a, b); | 44 assertListEquals(a, b); |
45 } | 45 } |
46 | 46 |
47 static assertTypeError(void f()) { | 47 static assertTypeError(void f()) { |
48 try { | 48 try { |
49 f(); | 49 f(); |
50 } catch (exception) { | 50 } catch (exception) { |
51 Expect.equals(true, (exception is TypeError) || | 51 Expect.equals(true, (exception is TypeError) || |
52 (exception is NoSuchMethodError) || | 52 (exception is NoSuchMethodError) || |
53 (exception is NullPointerException) || | 53 (exception is NullPointerException) || |
54 (exception is IllegalArgumentException)); | 54 (exception is ArgumentError)); |
55 return; | 55 return; |
56 } | 56 } |
57 Expect.equals(true, false); | 57 Expect.equals(true, false); |
58 } | 58 } |
59 | 59 |
60 static testBooleanOperators() { | 60 static testBooleanOperators() { |
61 var x = true, y = false; | 61 var x = true, y = false; |
62 assertEquals(x, true); | 62 assertEquals(x, true); |
63 assertEquals(y, false); | 63 assertEquals(y, false); |
64 assertEquals(x, !y); | 64 assertEquals(x, !y); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |