diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-11-24 22:48:05 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-11-29 20:36:05 +0100 |
commit | 673f9d313a981be3882050849d621bd12f07291c (patch) | |
tree | 45ca13a9fd14e25d8ea7581f48e7f1882fca20e0 /libbindgen/tests | |
parent | ebef1423cde4afa8d1f97a6f91ad466642a41b1c (diff) |
ir: Don't assume our name is our base name too early when we're in a namespace.
Diffstat (limited to 'libbindgen/tests')
-rw-r--r-- | libbindgen/tests/expectations/tests/nested_within_namespace.rs | 53 | ||||
-rw-r--r-- | libbindgen/tests/headers/nested_within_namespace.hpp | 15 |
2 files changed, 68 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/nested_within_namespace.rs b/libbindgen/tests/expectations/tests/nested_within_namespace.rs new file mode 100644 index 00000000..949b5adb --- /dev/null +++ b/libbindgen/tests/expectations/tests/nested_within_namespace.rs @@ -0,0 +1,53 @@ +/* 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, + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Bar_Baz { + pub foo: ::std::os::raw::c_int, + } + #[test] + fn bindgen_test_layout_Bar_Baz() { + assert_eq!(::std::mem::size_of::<Bar_Baz>() , 4usize); + assert_eq!(::std::mem::align_of::<Bar_Baz>() , 4usize); + } + impl Clone for Bar_Baz { + fn clone(&self) -> Self { *self } + } + #[test] + fn bindgen_test_layout_Bar() { + assert_eq!(::std::mem::size_of::<Bar>() , 4usize); + assert_eq!(::std::mem::align_of::<Bar>() , 4usize); + } + impl Clone for Bar { + fn clone(&self) -> Self { *self } + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Baz { + pub baz: ::std::os::raw::c_int, + } + #[test] + fn bindgen_test_layout_Baz() { + assert_eq!(::std::mem::size_of::<Baz>() , 4usize); + assert_eq!(::std::mem::align_of::<Baz>() , 4usize); + } + impl Clone for Baz { + fn clone(&self) -> Self { *self } + } + } +} diff --git a/libbindgen/tests/headers/nested_within_namespace.hpp b/libbindgen/tests/headers/nested_within_namespace.hpp new file mode 100644 index 00000000..a9b7c1ec --- /dev/null +++ b/libbindgen/tests/headers/nested_within_namespace.hpp @@ -0,0 +1,15 @@ +// bindgen-flags: --enable-cxx-namespaces + +namespace foo { + class Bar { + int foo; + + class Baz { + int foo; + }; + }; + + class Baz { + int baz; + }; +} |