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

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

Issue 10943027: Handle backslashes and newlines when escaping strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 3 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
« no previous file with comments | « dart/runtime/lib/errors_patch.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 main() { 5 main() {
6 Expect.stringEquals('1', NoSuchMethodError.safeToString(1)); 6 Expect.stringEquals('1', NoSuchMethodError.safeToString(1));
7 Expect.stringEquals('0.5', NoSuchMethodError.safeToString(0.5)); 7 Expect.stringEquals('0.5', NoSuchMethodError.safeToString(0.5));
8 Expect.stringEquals('"1"', NoSuchMethodError.safeToString("1")); 8 Expect.stringEquals('"1"', NoSuchMethodError.safeToString("1"));
9 Expect.stringEquals('"\'"', NoSuchMethodError.safeToString("'")); 9 Expect.stringEquals('"\'"', NoSuchMethodError.safeToString("'"));
10 Expect.stringEquals('"\'\'"', NoSuchMethodError.safeToString("''")); 10 Expect.stringEquals('"\'\'"', NoSuchMethodError.safeToString("''"));
11 Expect.stringEquals(r'"\""', NoSuchMethodError.safeToString('"')); 11 Expect.stringEquals(r'"\""', NoSuchMethodError.safeToString('"'));
12 Expect.stringEquals(r'"\"\""', NoSuchMethodError.safeToString('""')); 12 Expect.stringEquals(r'"\"\""', NoSuchMethodError.safeToString('""'));
13
14 Expect.stringEquals(r'"\\\"\n\r"', NoSuchMethodError.safeToString('\\"\n\r'));
15
13 Expect.stringEquals('null', NoSuchMethodError.safeToString(null)); 16 Expect.stringEquals('null', NoSuchMethodError.safeToString(null));
14 Expect.stringEquals('true', NoSuchMethodError.safeToString(true)); 17 Expect.stringEquals('true', NoSuchMethodError.safeToString(true));
15 Expect.stringEquals('false', NoSuchMethodError.safeToString(false)); 18 Expect.stringEquals('false', NoSuchMethodError.safeToString(false));
16 Expect.stringEquals("Instance of 'Object'", 19 Expect.stringEquals("Instance of 'Object'",
17 NoSuchMethodError.safeToString(new Object())); 20 NoSuchMethodError.safeToString(new Object()));
18 } 21 }
OLDNEW
« no previous file with comments | « dart/runtime/lib/errors_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698