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

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

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class StringEscapesTest {
6
7 static testMain() {
8 testDelimited();
9 testFixed2();
10 testFixed4();
11 testEscapes();
12 testLiteral();
13 }
14
15 static testDelimited() {
16 String str = "Foo\u{1}Bar\u{000001}Baz\u{D7FF}Boo";
17 Expect.equals(15, str.length);
18 Expect.equals(1, str.charCodeAt(3));
19 Expect.equals(1, str.charCodeAt(7));
20 Expect.equals(0xD7FF, str.charCodeAt(11));
21 Expect.equals('B'.charCodeAt(0), str.charCodeAt(12));
22 }
23
24 static testEscapes() {
25 String str = "Foo\fBar\vBaz\bBoo";
26 Expect.equals(15, str.length);
27 Expect.equals(12, str.charCodeAt(3));
28 Expect.equals('B'.charCodeAt(0), str.charCodeAt(4));
29 Expect.equals(11, str.charCodeAt(7));
30 Expect.equals('z'.charCodeAt(0), str.charCodeAt(10));
31 Expect.equals(8, str.charCodeAt(11));
32 Expect.equals('o'.charCodeAt(0), str.charCodeAt(14));
33 str = "Abc\rDef\nGhi\tJkl";
34 Expect.equals(15, str.length);
35 Expect.equals(13, str.charCodeAt(3));
36 Expect.equals('D'.charCodeAt(0), str.charCodeAt(4));
37 Expect.equals(10, str.charCodeAt(7));
38 Expect.equals('G'.charCodeAt(0), str.charCodeAt(8));
39 Expect.equals(9, str.charCodeAt(11));
40 Expect.equals('J'.charCodeAt(0), str.charCodeAt(12));
41 }
42
43 static testFixed2() {
44 String str = "Foo\xFFBar";
45 Expect.equals(7, str.length);
46 Expect.equals(255, str.charCodeAt(3));
47 Expect.equals('B'.charCodeAt(0), str.charCodeAt(4));
48 }
49
50 static testFixed4() {
51 String str = "Foo\u0001Bar";
52 Expect.equals(7, str.length);
53 Expect.equals(1, str.charCodeAt(3));
54 Expect.equals('B'.charCodeAt(0), str.charCodeAt(4));
55 }
56
57 static testLiteral() {
58 String str = "\a\c\d\e\g\h\i\j\k\l\$\{\}\"";
59 Expect.equals(@'acdeghijkl${}"', str);
60 }
61 }
62
63 main() {
64 StringEscapesTest.testMain();
65 }
OLDNEW
« no previous file with comments | « tests/language/src/StringEscape4NegativeTest.dart ('k') | tests/language/src/StringInterpolate1NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698