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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 /** | 7 /** |
8 * A test of simple runtime behavior on numbers, strings and lists with | 8 * A test of simple runtime behavior on numbers, strings and lists with |
9 * a focus on both correct behavior and runtime errors. | 9 * a focus on both correct behavior and runtime errors. |
10 * | 10 * |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 assertEquals(s.length, 6); | 160 assertEquals(s.length, 6); |
161 assertTypeError(() { s[null]; }); | 161 assertTypeError(() { s[null]; }); |
162 assertTypeError(() { s['hello']; }); | 162 assertTypeError(() { s['hello']; }); |
163 assertTypeError(() { s[0] = 'x'; }); | 163 assertTypeError(() { s[0] = 'x'; }); |
164 } | 164 } |
165 | 165 |
166 // TODO(jimhug): Fill out full set of string methods. | 166 // TODO(jimhug): Fill out full set of string methods. |
167 static testStringMethods() { | 167 static testStringMethods() { |
168 var s = "abcdef"; | 168 var s = "abcdef"; |
169 assertEquals(s.isEmpty, false); | 169 assertEquals(s.isEmpty, false); |
| 170 assertEquals(s.isNotEmpty, true); |
170 assertEquals(s.startsWith("abc"), true); | 171 assertEquals(s.startsWith("abc"), true); |
171 assertEquals(s.endsWith("def"), true); | 172 assertEquals(s.endsWith("def"), true); |
172 assertEquals(s.startsWith("aa"), false); | 173 assertEquals(s.startsWith("aa"), false); |
173 assertEquals(s.endsWith("ff"), false); | 174 assertEquals(s.endsWith("ff"), false); |
174 assertEquals(s.contains('cd', 0), true); | 175 assertEquals(s.contains('cd', 0), true); |
175 assertEquals(s.contains('cd', 2), true); | 176 assertEquals(s.contains('cd', 2), true); |
176 assertEquals(s.contains('cd', 3), false); | 177 assertEquals(s.contains('cd', 3), false); |
177 assertEquals(s.indexOf('cd', 2), 2); | 178 assertEquals(s.indexOf('cd', 2), 2); |
178 assertEquals(s.indexOf('cd', 3), -1); | 179 assertEquals(s.indexOf('cd', 3), -1); |
179 | 180 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 '${true}'.toString(); | 277 '${true}'.toString(); |
277 '${false}'.toString(); | 278 '${false}'.toString(); |
278 ''.toString(); | 279 ''.toString(); |
279 ''.endsWith(''); | 280 ''.endsWith(''); |
280 } | 281 } |
281 } | 282 } |
282 | 283 |
283 main() { | 284 main() { |
284 CoreRuntimeTypesTest.testMain(); | 285 CoreRuntimeTypesTest.testMain(); |
285 } | 286 } |
OLD | NEW |