summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libbindgen/tests')
-rw-r--r--libbindgen/tests/expectations/tests/duplicated_constants_in_ns.rs3
-rw-r--r--libbindgen/tests/expectations/tests/namespace.rs5
-rw-r--r--libbindgen/tests/expectations/tests/template_alias_namespace.rs3
-rw-r--r--libbindgen/tests/expectations/tests/whitelist-namespaces-basic.rs31
-rw-r--r--libbindgen/tests/expectations/tests/whitelist-namespaces.rs44
-rw-r--r--libbindgen/tests/headers/whitelist-namespaces-basic.hpp10
-rw-r--r--libbindgen/tests/headers/whitelist-namespaces.hpp10
7 files changed, 106 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/duplicated_constants_in_ns.rs b/libbindgen/tests/expectations/tests/duplicated_constants_in_ns.rs
index cb69890c..3acc53e8 100644
--- a/libbindgen/tests/expectations/tests/duplicated_constants_in_ns.rs
+++ b/libbindgen/tests/expectations/tests/duplicated_constants_in_ns.rs
@@ -5,12 +5,15 @@
pub mod root {
+ #[allow(unused_imports)]
use root;
pub mod foo {
+ #[allow(unused_imports)]
use root;
pub const FOO: ::std::os::raw::c_int = 4;
}
pub mod bar {
+ #[allow(unused_imports)]
use root;
pub const FOO: ::std::os::raw::c_int = 5;
}
diff --git a/libbindgen/tests/expectations/tests/namespace.rs b/libbindgen/tests/expectations/tests/namespace.rs
index bc8bae68..abb48204 100644
--- a/libbindgen/tests/expectations/tests/namespace.rs
+++ b/libbindgen/tests/expectations/tests/namespace.rs
@@ -5,12 +5,14 @@
pub mod root {
+ #[allow(unused_imports)]
use root;
extern "C" {
#[link_name = "_Z9top_levelv"]
pub fn top_level();
}
pub mod whatever {
+ #[allow(unused_imports)]
use root;
pub type whatever_int_t = ::std::os::raw::c_int;
extern "C" {
@@ -19,8 +21,10 @@ pub mod root {
}
}
pub mod _bindgen_mod_id_13 {
+ #[allow(unused_imports)]
use root;
pub mod empty {
+ #[allow(unused_imports)]
use root;
}
extern "C" {
@@ -50,6 +54,7 @@ pub mod root {
pub m_c_arr: [T; 10usize],
}
pub mod w {
+ #[allow(unused_imports)]
use root;
pub type whatever_int_t = ::std::os::raw::c_uint;
#[repr(C)]
diff --git a/libbindgen/tests/expectations/tests/template_alias_namespace.rs b/libbindgen/tests/expectations/tests/template_alias_namespace.rs
index 475c2b05..36806d44 100644
--- a/libbindgen/tests/expectations/tests/template_alias_namespace.rs
+++ b/libbindgen/tests/expectations/tests/template_alias_namespace.rs
@@ -5,10 +5,13 @@
pub mod root {
+ #[allow(unused_imports)]
use root;
pub mod JS {
+ #[allow(unused_imports)]
use root;
pub mod detail {
+ #[allow(unused_imports)]
use root;
pub type Wrapped<T> = T;
}
diff --git a/libbindgen/tests/expectations/tests/whitelist-namespaces-basic.rs b/libbindgen/tests/expectations/tests/whitelist-namespaces-basic.rs
new file mode 100644
index 00000000..8806cbf4
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/whitelist-namespaces-basic.rs
@@ -0,0 +1,31 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use root;
+ pub mod outer {
+ #[allow(unused_imports)]
+ use root;
+ pub mod inner {
+ #[allow(unused_imports)]
+ use root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Helper {
+ pub _address: u8,
+ }
+ #[test]
+ fn bindgen_test_layout_Helper() {
+ assert_eq!(::std::mem::size_of::<Helper>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Helper>() , 1usize);
+ }
+ impl Clone for Helper {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+ }
+}
diff --git a/libbindgen/tests/expectations/tests/whitelist-namespaces.rs b/libbindgen/tests/expectations/tests/whitelist-namespaces.rs
new file mode 100644
index 00000000..42cccdee
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/whitelist-namespaces.rs
@@ -0,0 +1,44 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use root;
+ pub mod outer {
+ #[allow(unused_imports)]
+ use root;
+ pub mod inner {
+ #[allow(unused_imports)]
+ use root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Helper {
+ pub _address: u8,
+ }
+ #[test]
+ fn bindgen_test_layout_Helper() {
+ assert_eq!(::std::mem::size_of::<Helper>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Helper>() , 1usize);
+ }
+ impl Clone for Helper {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Test {
+ pub helper: root::outer::inner::Helper,
+ }
+ #[test]
+ fn bindgen_test_layout_Test() {
+ assert_eq!(::std::mem::size_of::<Test>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Test>() , 1usize);
+ }
+ impl Clone for Test {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+}
diff --git a/libbindgen/tests/headers/whitelist-namespaces-basic.hpp b/libbindgen/tests/headers/whitelist-namespaces-basic.hpp
new file mode 100644
index 00000000..b631d290
--- /dev/null
+++ b/libbindgen/tests/headers/whitelist-namespaces-basic.hpp
@@ -0,0 +1,10 @@
+// bindgen-flags: --enable-cxx-namespaces --whitelist-type '.*Helper'
+
+namespace outer {
+ namespace inner {
+ struct Helper {};
+ }
+ struct Test {
+ inner::Helper helper;
+ };
+}
diff --git a/libbindgen/tests/headers/whitelist-namespaces.hpp b/libbindgen/tests/headers/whitelist-namespaces.hpp
new file mode 100644
index 00000000..d34cbe94
--- /dev/null
+++ b/libbindgen/tests/headers/whitelist-namespaces.hpp
@@ -0,0 +1,10 @@
+// bindgen-flags: --enable-cxx-namespaces --whitelist-type '.*'
+
+namespace outer {
+ namespace inner {
+ struct Helper {};
+ }
+ struct Test {
+ inner::Helper helper;
+ };
+}