OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 7 main() { |
| 8 Expect.stringEquals('1', Error.safeToString(1)); |
| 9 Expect.stringEquals('0.5', Error.safeToString(0.5)); |
| 10 Expect.stringEquals('"1"', Error.safeToString("1")); |
| 11 Expect.stringEquals('"\'"', Error.safeToString("'")); |
| 12 Expect.stringEquals('"\'\'"', Error.safeToString("''")); |
| 13 Expect.stringEquals(r'"\""', Error.safeToString('"')); |
| 14 Expect.stringEquals(r'"\"\""', Error.safeToString('""')); |
| 15 |
| 16 Expect.stringEquals(r'"\\\"\n\r"', Error.safeToString('\\"\n\r')); |
| 17 |
| 18 Expect.stringEquals(r'"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007"', |
| 19 Error.safeToString('\x00\x01\x02\x03\x04\x05\x06\x07')); |
| 20 Expect.stringEquals(r'"\b\t\n\u000b\f\r\u000e\u000f"', |
| 21 Error.safeToString('\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')); |
| 22 Expect.stringEquals(r'"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017"', |
| 23 Error.safeToString('\x10\x11\x12\x13\x14\x15\x16\x17')); |
| 24 Expect.stringEquals(r'"\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f"', |
| 25 Error.safeToString('\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f')); |
| 26 Expect.stringEquals('" "', Error.safeToString(" ")); |
| 27 |
| 28 Expect.stringEquals('null', Error.safeToString(null)); |
| 29 Expect.stringEquals('true', Error.safeToString(true)); |
| 30 Expect.stringEquals('false', Error.safeToString(false)); |
| 31 // The class name may be minified. |
| 32 String className = "$Object"; |
| 33 Expect.stringEquals("Instance of '$className'", |
| 34 Error.safeToString(new Object())); |
| 35 } |
OLD | NEW |