summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2016-12-02 13:43:54 -0800
committerNick Fitzgerald <fitzgen@gmail.com>2016-12-02 13:43:54 -0800
commit2c43aaef40ca43ed7be52ea738065bfbe3baae6c (patch)
treeeb608c272e948b4b4c7f5b0d86ff551324f1f882 /libbindgen/tests
parentb8014b1034ac486d3169e71d58e6387f8b1d25f1 (diff)
Do not treat parent struct as a module for nested structs
This fixes `ItemCanonicalPath` to return paths of the form `[module*, item]` rather than `[item*, item]`. That is, there will only be module names before the item's name, rather than also other arbitrary item names (such as parent structs). Fixes #311
Diffstat (limited to 'libbindgen/tests')
-rw-r--r--libbindgen/tests/expectations/tests/issue_311.rs38
-rw-r--r--libbindgen/tests/headers/issue_311.hpp5
2 files changed, 43 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/issue_311.rs b/libbindgen/tests/expectations/tests/issue_311.rs
new file mode 100644
index 00000000..f01a9d93
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/issue_311.rs
@@ -0,0 +1,38 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub mod root {
+ #[allow(unused_imports)]
+ use self::super::root;
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct jsval_layout {
+ pub __bindgen_anon_1: root::jsval_layout__bindgen_ty_1,
+ }
+ #[repr(C)]
+ #[derive(Debug, Copy)]
+ pub struct jsval_layout__bindgen_ty_1 {
+ pub _address: u8,
+ }
+ #[test]
+ fn bindgen_test_layout_jsval_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_1>() ,
+ 1usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_1>() ,
+ 1usize);
+ }
+ impl Clone for jsval_layout__bindgen_ty_1 {
+ fn clone(&self) -> Self { *self }
+ }
+ #[test]
+ fn bindgen_test_layout_jsval_layout() {
+ assert_eq!(::std::mem::size_of::<jsval_layout>() , 1usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout>() , 1usize);
+ }
+ impl Clone for jsval_layout {
+ fn clone(&self) -> Self { *self }
+ }
+}
diff --git a/libbindgen/tests/headers/issue_311.hpp b/libbindgen/tests/headers/issue_311.hpp
new file mode 100644
index 00000000..a8d7fd99
--- /dev/null
+++ b/libbindgen/tests/headers/issue_311.hpp
@@ -0,0 +1,5 @@
+// bindgen-flags: --enable-cxx-namespaces
+
+struct jsval_layout {
+ struct {};
+};