about summary refs log tree commit diff
path: root/library/std/src/sys/os_str/bytes
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2024-01-15 16:26:25 +0100
committerjoboet <jonasboettiger@icloud.com>2024-01-15 16:26:25 +0100
commit70b03645002e50fbe0c8ed29a0b0e801ace48a10 (patch)
treeba507b60ba11158a9c77a7d3346fb83dfe4f462b /library/std/src/sys/os_str/bytes
parent8847bda592d940ae1f34d87d8cacdc09a9f787fa (diff)
downloadrust-70b03645002e50fbe0c8ed29a0b0e801ace48a10.tar.gz
rust-70b03645002e50fbe0c8ed29a0b0e801ace48a10.zip
std: move OS String implementation into `sys`
Diffstat (limited to 'library/std/src/sys/os_str/bytes')
-rw-r--r--library/std/src/sys/os_str/bytes/tests.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/library/std/src/sys/os_str/bytes/tests.rs b/library/std/src/sys/os_str/bytes/tests.rs
new file mode 100644
index 00000000000..e2a99045e41
--- /dev/null
+++ b/library/std/src/sys/os_str/bytes/tests.rs
@@ -0,0 +1,17 @@
+use super::*;
+
+#[test]
+fn slice_debug_output() {
+    let input = unsafe { Slice::from_encoded_bytes_unchecked(b"\xF0hello,\tworld") };
+    let expected = r#""\xF0hello,\tworld""#;
+    let output = format!("{input:?}");
+
+    assert_eq!(output, expected);
+}
+
+#[test]
+fn display() {
+    assert_eq!("Hello\u{FFFD}\u{FFFD} There\u{FFFD} Goodbye", unsafe {
+        Slice::from_encoded_bytes_unchecked(b"Hello\xC0\x80 There\xE6\x83 Goodbye").to_string()
+    },);
+}