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/char_escape_test.dart

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 5
6 class CharEscapeTest { 6 class CharEscapeTest {
7 static testMain() { 7 static testMain() {
8 var x00 = "\x00"; 8 var x00 = "\x00";
9 var u0000 = "\u0000"; 9 var u0000 = "\u0000";
10 var v0 = "\u{0}"; 10 var v0 = "\u{0}";
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 Expect.equals(0xFFFF, vFFFF.charCodeAt(0)); 359 Expect.equals(0xFFFF, vFFFF.charCodeAt(0));
360 Expect.equals(0xFFFF, v0FFFF.charCodeAt(0)); 360 Expect.equals(0xFFFF, v0FFFF.charCodeAt(0));
361 Expect.equals(0xFFFF, v00FFFF.charCodeAt(0)); 361 Expect.equals(0xFFFF, v00FFFF.charCodeAt(0));
362 Expect.equals("\uFFFF", new String.fromCharCodes([0xFFFF])); 362 Expect.equals("\uFFFF", new String.fromCharCodes([0xFFFF]));
363 Expect.equals("\u{FFFF}", new String.fromCharCodes([0xFFFF])); 363 Expect.equals("\u{FFFF}", new String.fromCharCodes([0xFFFF]));
364 Expect.equals("\u{0FFFF}", new String.fromCharCodes([0xFFFF])); 364 Expect.equals("\u{0FFFF}", new String.fromCharCodes([0xFFFF]));
365 Expect.equals("\u{00FFFF}", new String.fromCharCodes([0xFFFF])); 365 Expect.equals("\u{00FFFF}", new String.fromCharCodes([0xFFFF]));
366 366
367 var v10000 = "\u{10000}"; 367 var v10000 = "\u{10000}";
368 var v010000 = "\u{010000}"; 368 var v010000 = "\u{010000}";
369 Expect.equals(1, v10000.length); 369 Expect.equals(2, v10000.length);
370 Expect.equals(1, v010000.length); 370 Expect.equals(2, v010000.length);
371 Expect.equals("\u{10000}", new String.fromCharCodes([0x10000])); 371 Expect.equals("\u{10000}", new String.fromCharCodes([0x10000]));
372 Expect.equals("\u{010000}", new String.fromCharCodes([0x10000])); 372 Expect.equals("\u{010000}", new String.fromCharCodes([0x10000]));
373 373
374 var v1FFFF = "\u{1FFFF}"; 374 var v1FFFF = "\u{1FFFF}";
375 var v01FFFF = "\u{01FFFF}"; 375 var v01FFFF = "\u{01FFFF}";
376 Expect.equals(1, v1FFFF.length); 376 Expect.equals(2, v1FFFF.length);
377 Expect.equals(1, v01FFFF.length); 377 Expect.equals(2, v01FFFF.length);
378 Expect.equals("\u{1FFFF}", new String.fromCharCodes([0x1FFFF])); 378 Expect.equals("\u{1FFFF}", new String.fromCharCodes([0x1FFFF]));
379 Expect.equals("\u{01FFFF}", new String.fromCharCodes([0x1FFFF])); 379 Expect.equals("\u{01FFFF}", new String.fromCharCodes([0x1FFFF]));
380 380
381 var v105555 = "\u{105555}"; 381 var v105555 = "\u{105555}";
382 Expect.equals(1, v105555.length); 382 Expect.equals(2, v105555.length);
383 Expect.equals("\u{105555}", new String.fromCharCodes([0x105555])); 383 Expect.equals("\u{105555}", new String.fromCharCodes([0x105555]));
384 384
385 var v10FFFF = "\u{10FFFF}"; 385 var v10FFFF = "\u{10FFFF}";
386 Expect.equals(1, v10FFFF.length); 386 Expect.equals(2, v10FFFF.length);
387 Expect.equals("\u{10FFFF}", new String.fromCharCodes([0x10FFFF])); 387 Expect.equals("\u{10FFFF}", new String.fromCharCodes([0x10FFFF]));
388 388
389 var bs = "\b"; 389 var bs = "\b";
390 Expect.isTrue(bs != "b"); 390 Expect.isTrue(bs != "b");
391 Expect.equals(1, bs.length); 391 Expect.equals(1, bs.length);
392 Expect.equals(0x08, bs.charCodeAt(0)); 392 Expect.equals(0x08, bs.charCodeAt(0));
393 Expect.equals(bs, new String.fromCharCodes([0x08])); 393 Expect.equals(bs, new String.fromCharCodes([0x08]));
394 Expect.equals("\x08", bs); 394 Expect.equals("\x08", bs);
395 Expect.equals("\u0008", bs); 395 Expect.equals("\u0008", bs);
396 Expect.equals("\u{8}", bs); 396 Expect.equals("\u{8}", bs);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 Expect.equals("\W", "W"); 522 Expect.equals("\W", "W");
523 Expect.equals("\X", "X"); 523 Expect.equals("\X", "X");
524 Expect.equals("\Y", "Y"); 524 Expect.equals("\Y", "Y");
525 Expect.equals("\Z", "Z"); 525 Expect.equals("\Z", "Z");
526 } 526 }
527 } 527 }
528 528
529 main() { 529 main() {
530 CharEscapeTest.testMain(); 530 CharEscapeTest.testMain();
531 } 531 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698