Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tests/language/src/CharEscapeTest.dart

Issue 9149005: split out vm-specific tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: keeping test closer to original Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Dart test for reading escape sequences in string literals 4 // Dart test for reading escape sequences in string literals
5 // This test only includes characters representable with 2 bytes so that even
6 // a dart implementation with the JS exemption is
7 // expected to pass them. See CharEscapeVMTest for the tests that a
8 // fully spec compliant implementation is expected to pass.
5 9
6 class CharEscapeTest { 10 class CharEscapeTest {
7 static testMain() { 11 static testMain() {
8 var x00 = "\x00"; 12 var x00 = "\x00";
9 var u0000 = "\u0000"; 13 var u0000 = "\u0000";
10 var v0 = "\u{0}"; 14 var v0 = "\u{0}";
11 var v00 = "\u{00}"; 15 var v00 = "\u{00}";
12 var v000 = "\u{000}"; 16 var v000 = "\u{000}";
13 var v0000 = "\u{0000}"; 17 var v0000 = "\u{0000}";
14 var v00000 = "\u{00000}"; 18 var v00000 = "\u{00000}";
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 Expect.equals(1, v00FFFF.length); 361 Expect.equals(1, v00FFFF.length);
358 Expect.equals(0xFFFF, uFFFF.charCodeAt(0)); 362 Expect.equals(0xFFFF, uFFFF.charCodeAt(0));
359 Expect.equals(0xFFFF, vFFFF.charCodeAt(0)); 363 Expect.equals(0xFFFF, vFFFF.charCodeAt(0));
360 Expect.equals(0xFFFF, v0FFFF.charCodeAt(0)); 364 Expect.equals(0xFFFF, v0FFFF.charCodeAt(0));
361 Expect.equals(0xFFFF, v00FFFF.charCodeAt(0)); 365 Expect.equals(0xFFFF, v00FFFF.charCodeAt(0));
362 Expect.equals("\uFFFF", new String.fromCharCodes([0xFFFF])); 366 Expect.equals("\uFFFF", new String.fromCharCodes([0xFFFF]));
363 Expect.equals("\u{FFFF}", new String.fromCharCodes([0xFFFF])); 367 Expect.equals("\u{FFFF}", new String.fromCharCodes([0xFFFF]));
364 Expect.equals("\u{0FFFF}", new String.fromCharCodes([0xFFFF])); 368 Expect.equals("\u{0FFFF}", new String.fromCharCodes([0xFFFF]));
365 Expect.equals("\u{00FFFF}", new String.fromCharCodes([0xFFFF])); 369 Expect.equals("\u{00FFFF}", new String.fromCharCodes([0xFFFF]));
366 370
367 var v10000 = "\u{10000}";
368 var v010000 = "\u{010000}";
369 Expect.equals(1, v10000.length);
370 Expect.equals(1, v010000.length);
371 Expect.equals("\u{10000}", new String.fromCharCodes([0x10000]));
372 Expect.equals("\u{010000}", new String.fromCharCodes([0x10000]));
373
374 var v1FFFF = "\u{1FFFF}";
375 var v01FFFF = "\u{01FFFF}";
376 Expect.equals(1, v1FFFF.length);
377 Expect.equals(1, v01FFFF.length);
378 Expect.equals("\u{1FFFF}", new String.fromCharCodes([0x1FFFF]));
379 Expect.equals("\u{01FFFF}", new String.fromCharCodes([0x1FFFF]));
380
381 var v105555 = "\u{105555}";
382 Expect.equals(1, v105555.length);
383 Expect.equals("\u{105555}", new String.fromCharCodes([0x105555]));
384
385 var v10FFFF = "\u{10FFFF}";
386 Expect.equals(1, v10FFFF.length);
387 Expect.equals("\u{10FFFF}", new String.fromCharCodes([0x10FFFF]));
388
389 var bs = "\b"; 371 var bs = "\b";
390 Expect.isTrue(bs != "b"); 372 Expect.isTrue(bs != "b");
391 Expect.equals(1, bs.length); 373 Expect.equals(1, bs.length);
392 Expect.equals(0x08, bs.charCodeAt(0)); 374 Expect.equals(0x08, bs.charCodeAt(0));
393 Expect.equals(bs, new String.fromCharCodes([0x08])); 375 Expect.equals(bs, new String.fromCharCodes([0x08]));
394 Expect.equals("\x08", bs); 376 Expect.equals("\x08", bs);
395 Expect.equals("\u0008", bs); 377 Expect.equals("\u0008", bs);
396 Expect.equals("\u{8}", bs); 378 Expect.equals("\u{8}", bs);
397 Expect.equals("\u{08}", bs); 379 Expect.equals("\u{08}", bs);
398 Expect.equals("\u{008}", bs); 380 Expect.equals("\u{008}", bs);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 Expect.equals("\W", "W"); 504 Expect.equals("\W", "W");
523 Expect.equals("\X", "X"); 505 Expect.equals("\X", "X");
524 Expect.equals("\Y", "Y"); 506 Expect.equals("\Y", "Y");
525 Expect.equals("\Z", "Z"); 507 Expect.equals("\Z", "Z");
526 } 508 }
527 } 509 }
528 510
529 main() { 511 main() {
530 CharEscapeTest.testMain(); 512 CharEscapeTest.testMain();
531 } 513 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698