mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 23:29:50 +00:00
Test Debug impls
This commit is contained in:
parent
f84c98bdb7
commit
990eb3cf82
@ -15,7 +15,7 @@ use std::os::raw::c_char;
|
||||
|
||||
#[cxx::bridge(namespace = "tests")]
|
||||
pub mod ffi {
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
struct Shared {
|
||||
z: usize,
|
||||
}
|
||||
@ -24,6 +24,7 @@ pub mod ffi {
|
||||
msg: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum Enum {
|
||||
AVal,
|
||||
BVal = 2020,
|
||||
|
@ -227,6 +227,13 @@ fn test_enum_representations() {
|
||||
assert_eq!(2021, ffi::Enum::CVal.repr);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_debug() {
|
||||
assert_eq!("Shared { z: 1 }", format!("{:?}", ffi::Shared { z: 1 }));
|
||||
assert_eq!("BVal", format!("{:?}", ffi::Enum::BVal));
|
||||
assert_eq!("Enum(9)", format!("{:?}", ffi::Enum { repr: 9 }));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn cxx_test_suite_get_box() -> *mut R {
|
||||
Box::into_raw(Box::new(R(2020usize)))
|
||||
|
Loading…
Reference in New Issue
Block a user