diff options
| author | varkor <github@varkor.com> | 2018-05-21 18:57:49 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-05-21 18:57:54 +0100 |
| commit | 2fa22effb6e1dd3b3e2e587ec5fcabefe2eb3443 (patch) | |
| tree | 512d4d77b9d2669e2eef75b8e0ee55d7c3450998 /src/liballoc/tests/str.rs | |
| parent | c51f00280205d476651ff9f9a46cff6645b411a2 (diff) | |
| download | rust-2fa22effb6e1dd3b3e2e587ec5fcabefe2eb3443.tar.gz rust-2fa22effb6e1dd3b3e2e587ec5fcabefe2eb3443.zip | |
Avoid counting characters and add explanatory comment to test
Diffstat (limited to 'src/liballoc/tests/str.rs')
| -rw-r--r-- | src/liballoc/tests/str.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/liballoc/tests/str.rs b/src/liballoc/tests/str.rs index 84c97abcbc2..d11bf5dc3e9 100644 --- a/src/liballoc/tests/str.rs +++ b/src/liballoc/tests/str.rs @@ -989,6 +989,12 @@ fn test_escape_unicode() { #[test] fn test_escape_debug() { + // Note that there are subtleties with the number of backslashes + // on the left- and right-hand sides. In particular, Unicode code points + // are usually escaped with two backslashes on the right-hand side, as + // they are escaped. However, when the character is unescaped (e.g. for + // printable characters), only a single backslash appears (as the character + // itself appears in the debug string). assert_eq!("abc".escape_debug(), "abc"); assert_eq!("a c".escape_debug(), "a c"); assert_eq!("éèê".escape_debug(), "éèê"); |
