diff options
author | mchlrhw <4028654+mchlrhw@users.noreply.github.com> | 2017-09-06 20:17:11 +0100 |
---|---|---|
committer | mchlrhw <4028654+mchlrhw@users.noreply.github.com> | 2017-09-06 20:17:11 +0100 |
commit | 537a49ef5268c9d6546e84579c3c5441652da1e5 (patch) | |
tree | 47cec54847e98d8b88839f3a1729d9b49c2ebe32 | |
parent | bb79e37797eef027c2a4534a450e2f9d5eafb28e (diff) |
Write test for `--no-derive--copy`
-rw-r--r-- | tests/expectations/tests/do-not-derive-copy.rs | 28 | ||||
-rw-r--r-- | tests/headers/do-not-derive-copy.hpp | 5 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/expectations/tests/do-not-derive-copy.rs b/tests/expectations/tests/do-not-derive-copy.rs new file mode 100644 index 00000000..114b73e3 --- /dev/null +++ b/tests/expectations/tests/do-not-derive-copy.rs @@ -0,0 +1,28 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +#[repr(C)] +#[derive(Debug, Default)] +pub struct WouldBeCopyButWeAreNotDerivingCopy { + pub x: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_WouldBeCopyButWeAreNotDerivingCopy() { + assert_eq!(::std::mem::size_of::<WouldBeCopyButWeAreNotDerivingCopy>() , + 4usize , concat ! ( + "Size of: " , stringify ! ( WouldBeCopyButWeAreNotDerivingCopy + ) )); + assert_eq! (::std::mem::align_of::<WouldBeCopyButWeAreNotDerivingCopy>() , + 4usize , concat ! ( + "Alignment of " , stringify ! ( + WouldBeCopyButWeAreNotDerivingCopy ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const WouldBeCopyButWeAreNotDerivingCopy ) ) . + x as * const _ as usize } , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( + WouldBeCopyButWeAreNotDerivingCopy ) , "::" , stringify ! ( x + ) )); +} diff --git a/tests/headers/do-not-derive-copy.hpp b/tests/headers/do-not-derive-copy.hpp new file mode 100644 index 00000000..18c26135 --- /dev/null +++ b/tests/headers/do-not-derive-copy.hpp @@ -0,0 +1,5 @@ +// bindgen-flags: --no-derive-copy + +class WouldBeCopyButWeAreNotDerivingCopy { + int x; +}; |