Skip to content

Commit 537a49e

Browse files
committed
Write test for --no-derive--copy
1 parent bb79e37 commit 537a49e

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
5+
6+
7+
#[repr(C)]
8+
#[derive(Debug, Default)]
9+
pub struct WouldBeCopyButWeAreNotDerivingCopy {
10+
pub x: ::std::os::raw::c_int,
11+
}
12+
#[test]
13+
fn bindgen_test_layout_WouldBeCopyButWeAreNotDerivingCopy() {
14+
assert_eq!(::std::mem::size_of::<WouldBeCopyButWeAreNotDerivingCopy>() ,
15+
4usize , concat ! (
16+
"Size of: " , stringify ! ( WouldBeCopyButWeAreNotDerivingCopy
17+
) ));
18+
assert_eq! (::std::mem::align_of::<WouldBeCopyButWeAreNotDerivingCopy>() ,
19+
4usize , concat ! (
20+
"Alignment of " , stringify ! (
21+
WouldBeCopyButWeAreNotDerivingCopy ) ));
22+
assert_eq! (unsafe {
23+
& ( * ( 0 as * const WouldBeCopyButWeAreNotDerivingCopy ) ) .
24+
x as * const _ as usize } , 0usize , concat ! (
25+
"Alignment of field: " , stringify ! (
26+
WouldBeCopyButWeAreNotDerivingCopy ) , "::" , stringify ! ( x
27+
) ));
28+
}

tests/headers/do-not-derive-copy.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// bindgen-flags: --no-derive-copy
2+
3+
class WouldBeCopyButWeAreNotDerivingCopy {
4+
int x;
5+
};

0 commit comments

Comments
 (0)