about summary refs log tree commit diff
path: root/library/std/src/path
diff options
context:
space:
mode:
authorschvv31n <tim.kurdov@gmail.com>2024-06-04 11:53:59 +0100
committerschvv31n <tim.kurdov@gmail.com>2024-06-04 11:53:59 +0100
commitfd5777c4c5c8fbc54d33d15afb29479180c532be (patch)
tree7ca803a02c33582b471e37d9acbe280e2d2df405 /library/std/src/path
parenteb5e2449c5a5215927834d67914ce41cccd3f3c9 (diff)
impl OsString::leak & PathBuf::leak
Diffstat (limited to 'library/std/src/path')
-rw-r--r--library/std/src/path/tests.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/std/src/path/tests.rs b/library/std/src/path/tests.rs
index 2d8e50d1f88..d29f895ba38 100644
--- a/library/std/src/path/tests.rs
+++ b/library/std/src/path/tests.rs
@@ -127,6 +127,13 @@ fn into() {
 }
 
 #[test]
+fn test_pathbuf_leak() {
+    let buf = PathBuf::from("/have/a/cake".to_owned());
+    let leaked = buf.leak();
+    assert_eq!(leaked.as_os_str().as_encoded_bytes(), b"/have/a/cake");
+}
+
+#[test]
 #[cfg(unix)]
 pub fn test_decompositions_unix() {
     t!("",