summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-22 10:27:47 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-22 10:33:50 +0100
commitb1736b936e6c8a5fd8885c3ea79e38a2be689d24 (patch)
tree4b70bfbcff59a06f9898f1c0d162ed49b50db1fe /libbindgen/tests
parentd4a66485a1438b5c3502fc1dd633ce42d9e04405 (diff)
ir: Deduplicate namespaces.
Diffstat (limited to 'libbindgen/tests')
-rw-r--r--libbindgen/tests/expectations/tests/duplicated-namespaces-definitions.rs45
-rw-r--r--libbindgen/tests/expectations/tests/duplicated-namespaces.rs14
-rw-r--r--libbindgen/tests/expectations/tests/typeref.rs26
-rw-r--r--libbindgen/tests/headers/duplicated-namespaces-definitions.hpp18
-rw-r--r--libbindgen/tests/headers/duplicated-namespaces.hpp4
5 files changed, 94 insertions, 13 deletions
diff --git a/libbindgen/tests/expectations/tests/duplicated-namespaces-definitions.rs b/libbindgen/tests/expectations/tests/duplicated-namespaces-definitions.rs
new file mode 100644
index 00000000..314a24a3
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/duplicated-namespaces-definitions.rs
@@ -0,0 +1,45 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use root;
+ pub mod foo {
+ #[allow(unused_imports)]
+ use root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Bar {
+ pub foo: ::std::os::raw::c_int,
+ pub baz: bool,
+ }
+ #[test]
+ fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+ }
+ impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+ pub mod bar {
+ #[allow(unused_imports)]
+ use root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct Foo {
+ pub ptr: *mut root::foo::Bar,
+ }
+ #[test]
+ fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 8usize);
+ }
+ impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+ }
+ }
+}
diff --git a/libbindgen/tests/expectations/tests/duplicated-namespaces.rs b/libbindgen/tests/expectations/tests/duplicated-namespaces.rs
new file mode 100644
index 00000000..786fe1a5
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/duplicated-namespaces.rs
@@ -0,0 +1,14 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use root;
+ pub mod std {
+ #[allow(unused_imports)]
+ use root;
+ }
+}
diff --git a/libbindgen/tests/expectations/tests/typeref.rs b/libbindgen/tests/expectations/tests/typeref.rs
index 21217ced..1188393d 100644
--- a/libbindgen/tests/expectations/tests/typeref.rs
+++ b/libbindgen/tests/expectations/tests/typeref.rs
@@ -68,19 +68,6 @@ impl Clone for mozilla_Position {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct Bar {
- pub mFoo: *mut nsFoo,
-}
-#[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 }
-}
-#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mozilla_StyleShapeSource<ReferenceBox> {
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1<ReferenceBox>,
@@ -94,3 +81,16 @@ pub struct mozilla_StyleShapeSource__bindgen_ty_1<ReferenceBox> {
pub bindgen_union_field: u64,
pub _phantom_0: ::std::marker::PhantomData<ReferenceBox>,
}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub mFoo: *mut nsFoo,
+}
+#[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/libbindgen/tests/headers/duplicated-namespaces-definitions.hpp b/libbindgen/tests/headers/duplicated-namespaces-definitions.hpp
new file mode 100644
index 00000000..7c8888de
--- /dev/null
+++ b/libbindgen/tests/headers/duplicated-namespaces-definitions.hpp
@@ -0,0 +1,18 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+namespace foo {
+ class Bar;
+}
+
+namespace bar {
+ struct Foo {
+ foo::Bar* ptr;
+ };
+};
+
+namespace foo {
+ class Bar {
+ int foo;
+ bool baz;
+ };
+}
diff --git a/libbindgen/tests/headers/duplicated-namespaces.hpp b/libbindgen/tests/headers/duplicated-namespaces.hpp
new file mode 100644
index 00000000..10e1933f
--- /dev/null
+++ b/libbindgen/tests/headers/duplicated-namespaces.hpp
@@ -0,0 +1,4 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+namespace std {}
+namespace std {}