aboutsummaryrefslogtreecommitdiff
path: root/tests/cxx_string.rs
blob: 67444fa56399b31c2722fa4a1199a6115c730d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use cxx::{let_cxx_string, CxxString};

#[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""#);
}