diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/cxx/tests/cxx_string.rs | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/cxx/tests/cxx_string.rs')
-rw-r--r-- | vendor/cxx/tests/cxx_string.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/vendor/cxx/tests/cxx_string.rs b/vendor/cxx/tests/cxx_string.rs deleted file mode 100644 index 349a4e1f1..000000000 --- a/vendor/cxx/tests/cxx_string.rs +++ /dev/null @@ -1,41 +0,0 @@ -use cxx::{let_cxx_string, CxxString}; -use std::fmt::Write as _; - -#[test] -fn test_async_cxx_string() { - async fn f() { - let_cxx_string!(s = "..."); - - async fn g(_: &CxxString) {} - g(&s).await; - } - - // https://github.com/dtolnay/cxx/issues/693 - fn assert_send(_: impl Send) {} - assert_send(f()); -} - -#[test] -fn test_debug() { - let_cxx_string!(s = "x\"y\'z"); - - assert_eq!(format!("{:?}", s), r#""x\"y'z""#); -} - -#[test] -fn test_fmt_write() { - let_cxx_string!(s = ""); - - let name = "world"; - write!(s, "Hello, {name}!").unwrap(); - assert_eq!(s.to_str(), Ok("Hello, world!")); -} - -#[test] -fn test_io_write() { - let_cxx_string!(s = ""); - let mut reader: &[u8] = b"Hello, world!"; - - std::io::copy(&mut reader, &mut s).unwrap(); - assert_eq!(s.to_str(), Ok("Hello, world!")); -} |