summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/expectations/tests/derive-partialeq-and-blacklist.rs30
-rw-r--r--tests/headers/derive-partialeq-and-blacklist.hpp11
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/expectations/tests/derive-partialeq-and-blacklist.rs b/tests/expectations/tests/derive-partialeq-and-blacklist.rs
new file mode 100644
index 00000000..4aac3c8c
--- /dev/null
+++ b/tests/expectations/tests/derive-partialeq-and-blacklist.rs
@@ -0,0 +1,30 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+
+pub struct BlacklistMe(u8);
+
+/// Because this type contains a blacklisted type, it should not derive
+/// PartialEq.
+#[repr(C)]
+pub struct ShouldNotDerivePartialEq {
+ pub a: BlacklistMe,
+}
+#[test]
+fn bindgen_test_layout_ShouldNotDerivePartialEq() {
+ assert_eq!(::std::mem::size_of::<ShouldNotDerivePartialEq>() , 1usize ,
+ concat ! (
+ "Size of: " , stringify ! ( ShouldNotDerivePartialEq ) ));
+ assert_eq! (::std::mem::align_of::<ShouldNotDerivePartialEq>() , 1usize ,
+ concat ! (
+ "Alignment of " , stringify ! ( ShouldNotDerivePartialEq ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const ShouldNotDerivePartialEq ) ) . a as *
+ const _ as usize } , 0usize , concat ! (
+ "Alignment of field: " , stringify ! (
+ ShouldNotDerivePartialEq ) , "::" , stringify ! ( a ) ));
+}
+impl Default for ShouldNotDerivePartialEq {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
diff --git a/tests/headers/derive-partialeq-and-blacklist.hpp b/tests/headers/derive-partialeq-and-blacklist.hpp
new file mode 100644
index 00000000..a996eee8
--- /dev/null
+++ b/tests/headers/derive-partialeq-and-blacklist.hpp
@@ -0,0 +1,11 @@
+// bindgen-flags: --with-derive-partialeq --blacklist-type BlacklistMe --raw-line 'pub struct BlacklistMe(u8);'
+
+struct BlacklistMe {};
+
+/**
+ * Because this type contains a blacklisted type, it should not derive
+ * PartialEq.
+ */
+struct ShouldNotDerivePartialEq {
+ BlacklistMe a;
+};