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

Side by Side Diff: tests/corelib/safe_to_string_test.dart

Issue 23116007: Make Error.safeToString convert control codes in strings to escapes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 7 years, 4 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
« sdk/lib/core/errors.dart ('K') | « sdk/lib/core/errors.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 main() { 7 main() {
8 Expect.stringEquals('1', Error.safeToString(1)); 8 Expect.stringEquals('1', Error.safeToString(1));
9 Expect.stringEquals('0.5', Error.safeToString(0.5)); 9 Expect.stringEquals('0.5', Error.safeToString(0.5));
10 Expect.stringEquals('"1"', Error.safeToString("1")); 10 Expect.stringEquals('"1"', Error.safeToString("1"));
11 Expect.stringEquals('"\'"', Error.safeToString("'")); 11 Expect.stringEquals('"\'"', Error.safeToString("'"));
12 Expect.stringEquals('"\'\'"', Error.safeToString("''")); 12 Expect.stringEquals('"\'\'"', Error.safeToString("''"));
13 Expect.stringEquals(r'"\""', Error.safeToString('"')); 13 Expect.stringEquals(r'"\""', Error.safeToString('"'));
14 Expect.stringEquals(r'"\"\""', Error.safeToString('""')); 14 Expect.stringEquals(r'"\"\""', Error.safeToString('""'));
15 15
16 Expect.stringEquals(r'"\\\"\n\r"', Error.safeToString('\\"\n\r')); 16 Expect.stringEquals(r'"\\\"\n\r"', Error.safeToString('\\"\n\r'));
17 17
18 Expect.stringEquals(r'"\x00\x01\x02\x03\x04\x05\x06\x07"',
19 Error.safeToString('\x00\x01\x02\x03\x04\x05\x06\x07'));
20 Expect.stringEquals(r'"\x08\t\n\x0b\x0c\r\x0e\x0f"',
21 Error.safeToString('\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'));
22 Expect.stringEquals(r'"\x10\x11\x12\x13\x14\x15\x16\x17"',
23 Error.safeToString('\x10\x11\x12\x13\x14\x15\x16\x17'));
24 Expect.stringEquals(r'"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"',
25 Error.safeToString('\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f'));
26 Expect.stringEquals('" "', Error.safeToString(" "));
27
18 Expect.stringEquals('null', Error.safeToString(null)); 28 Expect.stringEquals('null', Error.safeToString(null));
19 Expect.stringEquals('true', Error.safeToString(true)); 29 Expect.stringEquals('true', Error.safeToString(true));
20 Expect.stringEquals('false', Error.safeToString(false)); 30 Expect.stringEquals('false', Error.safeToString(false));
21 Expect.stringEquals("Instance of 'Object'", 31 Expect.stringEquals("Instance of 'Object'",
22 Error.safeToString(new Object())); 32 Error.safeToString(new Object()));
23 } 33 }
OLDNEW
« sdk/lib/core/errors.dart ('K') | « sdk/lib/core/errors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698