diff options
-rw-r--r-- | tests/expectations/tests/gen-constructors-neg.rs | 21 | ||||
-rw-r--r-- | tests/expectations/tests/gen-destructors-neg.rs | 23 | ||||
-rw-r--r-- | tests/headers/gen-constructors-neg.hpp | 6 | ||||
-rw-r--r-- | tests/headers/gen-destructors-neg.hpp | 9 |
4 files changed, 59 insertions, 0 deletions
diff --git a/tests/expectations/tests/gen-constructors-neg.rs b/tests/expectations/tests/gen-constructors-neg.rs new file mode 100644 index 00000000..fbeb3d5e --- /dev/null +++ b/tests/expectations/tests/gen-constructors-neg.rs @@ -0,0 +1,21 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Default, Copy)] +pub struct Foo { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_Foo() { + assert_eq!(::std::mem::size_of::<Foo>() , 1usize , concat ! ( + "Size of: " , stringify ! ( Foo ) )); + assert_eq! (::std::mem::align_of::<Foo>() , 1usize , concat ! ( + "Alignment of " , stringify ! ( Foo ) )); +} +impl Clone for Foo { + fn clone(&self) -> Self { *self } +} diff --git a/tests/expectations/tests/gen-destructors-neg.rs b/tests/expectations/tests/gen-destructors-neg.rs new file mode 100644 index 00000000..4aaec83a --- /dev/null +++ b/tests/expectations/tests/gen-destructors-neg.rs @@ -0,0 +1,23 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Default)] +pub struct Foo { + pub bar: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_Foo() { + assert_eq!(::std::mem::size_of::<Foo>() , 4usize , concat ! ( + "Size of: " , stringify ! ( Foo ) )); + assert_eq! (::std::mem::align_of::<Foo>() , 4usize , concat ! ( + "Alignment of " , stringify ! ( Foo ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const Foo ) ) . bar as * const _ as usize } , + 0usize , concat ! ( + "Alignment of field: " , stringify ! ( Foo ) , "::" , + stringify ! ( bar ) )); +} diff --git a/tests/headers/gen-constructors-neg.hpp b/tests/headers/gen-constructors-neg.hpp new file mode 100644 index 00000000..2dd491c4 --- /dev/null +++ b/tests/headers/gen-constructors-neg.hpp @@ -0,0 +1,6 @@ +// bindgen-flags: --generate types,functions + +class Foo { + public: + Foo(int a); +}; diff --git a/tests/headers/gen-destructors-neg.hpp b/tests/headers/gen-destructors-neg.hpp new file mode 100644 index 00000000..5ede3ba3 --- /dev/null +++ b/tests/headers/gen-destructors-neg.hpp @@ -0,0 +1,9 @@ +// bindgen-flags: --generate types,functions +// +// NB: This is intended to _not_ generate destructors. + +class Foo { + int bar; + public: + ~Foo(); +}; |