| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } catch (e) { } | 146 } catch (e) { } |
| 147 try { | 147 try { |
| 148 y.toRadixString(-1); | 148 y.toRadixString(-1); |
| 149 Expect.fail("Illegal radix -1 accepted."); | 149 Expect.fail("Illegal radix -1 accepted."); |
| 150 } catch (e) { } | 150 } catch (e) { } |
| 151 } | 151 } |
| 152 | 152 |
| 153 static testStringOperators() { | 153 static testStringOperators() { |
| 154 var s = "abcdef"; | 154 var s = "abcdef"; |
| 155 assertEquals(s, "abcdef"); | 155 assertEquals(s, "abcdef"); |
| 156 assertEquals(s.charCodeAt(0), 97); | 156 assertEquals(s.codeUnitAt(0), 97); |
| 157 assertEquals(s[0], 'a'); | 157 assertEquals(s[0], 'a'); |
| 158 assertEquals(s.length, 6); | 158 assertEquals(s.length, 6); |
| 159 assertTypeError(() { s[null]; }); | 159 assertTypeError(() { s[null]; }); |
| 160 assertTypeError(() { s['hello']; }); | 160 assertTypeError(() { s['hello']; }); |
| 161 assertTypeError(() { s[0] = 'x'; }); | 161 assertTypeError(() { s[0] = 'x'; }); |
| 162 } | 162 } |
| 163 | 163 |
| 164 // TODO(jimhug): Fill out full set of string methods. | 164 // TODO(jimhug): Fill out full set of string methods. |
| 165 static testStringMethods() { | 165 static testStringMethods() { |
| 166 var s = "abcdef"; | 166 var s = "abcdef"; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |