summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/tests/forward-declaration-autoptr.rs27
-rw-r--r--tests/expectations/tests/forward_declared_complex_types.rs3
-rw-r--r--tests/expectations/tests/same_struct_name_in_different_namespaces.rs1
-rw-r--r--tests/headers/forward-declaration-autoptr.hpp10
4 files changed, 41 insertions, 0 deletions
diff --git a/tests/expectations/tests/forward-declaration-autoptr.rs b/tests/expectations/tests/forward-declaration-autoptr.rs
new file mode 100644
index 00000000..31013d3a
--- /dev/null
+++ b/tests/expectations/tests/forward-declaration-autoptr.rs
@@ -0,0 +1,27 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Foo([u8; 0]);
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct RefPtr<T> {
+ pub m_inner: *mut T,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub m_member: RefPtr<Foo>,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 8usize);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs
index 77849a91..119ea2b5 100644
--- a/tests/expectations/tests/forward_declared_complex_types.rs
+++ b/tests/expectations/tests/forward_declared_complex_types.rs
@@ -18,6 +18,7 @@ impl Clone for Foo_empty {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
+#[derive(Debug, Copy, Clone)]
pub struct Foo([u8; 0]);
#[repr(C)]
#[derive(Debug, Copy)]
@@ -37,12 +38,14 @@ extern "C" {
pub fn baz_struct(f: *mut Foo);
}
#[repr(C)]
+#[derive(Debug, Copy, Clone)]
pub struct Union([u8; 0]);
extern "C" {
#[link_name = "_Z9baz_unionP5Union"]
pub fn baz_union(u: *mut Union);
}
#[repr(C)]
+#[derive(Debug, Copy, Clone)]
pub struct Quux([u8; 0]);
extern "C" {
#[link_name = "_Z9baz_classP4Quux"]
diff --git a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
index c59e4d44..dbf93daa 100644
--- a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
+++ b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
@@ -5,6 +5,7 @@
#[repr(C)]
+#[derive(Debug, Copy, Clone)]
pub struct JS_Zone([u8; 0]);
#[repr(C)]
#[derive(Debug, Copy)]
diff --git a/tests/headers/forward-declaration-autoptr.hpp b/tests/headers/forward-declaration-autoptr.hpp
new file mode 100644
index 00000000..a26c1cd2
--- /dev/null
+++ b/tests/headers/forward-declaration-autoptr.hpp
@@ -0,0 +1,10 @@
+class Foo;
+
+template <typename T>
+struct RefPtr {
+ T* m_inner;
+};
+
+struct Bar {
+ RefPtr<Foo> m_member;
+};