diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-05 09:38:01 -0800 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-07 16:07:38 -1000 |
commit | f684e77b950c00454909a54df7a26335b68e05ca (patch) | |
tree | 34e10c238673d3215500ba48f7f8b170670505d6 /libbindgen/tests | |
parent | 9ac59f8ad0171dc93cced2a2d69b49fcf13f814a (diff) |
ir: Saner whitelisting/blacklisting.
Diffstat (limited to 'libbindgen/tests')
6 files changed, 53 insertions, 6 deletions
diff --git a/libbindgen/tests/expectations/tests/reparented_replacement.rs b/libbindgen/tests/expectations/tests/reparented_replacement.rs new file mode 100644 index 00000000..74ee229c --- /dev/null +++ b/libbindgen/tests/expectations/tests/reparented_replacement.rs @@ -0,0 +1,29 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod foo { + #[allow(unused_imports)] + use self::super::super::root; + /// <div rustbindgen replaces="foo::Bar"></div> + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Bar { + pub bazz: ::std::os::raw::c_int, + } + #[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 } + } + } + pub type ReferencesBar = root::foo::Bar; +} diff --git a/libbindgen/tests/expectations/tests/replace_template_alias.rs b/libbindgen/tests/expectations/tests/replace_template_alias.rs index b9a0d0c9..f922ac77 100644 --- a/libbindgen/tests/expectations/tests/replace_template_alias.rs +++ b/libbindgen/tests/expectations/tests/replace_template_alias.rs @@ -4,12 +4,12 @@ #![allow(non_snake_case)] +/// But the replacement type does use T! +/// +/// <div rustbindgen replaces="JS::detail::MaybeWrapped" /> +pub type JS_detail_MaybeWrapped<T> = T; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct JS_Rooted<T> { pub ptr: JS_detail_MaybeWrapped<T>, } -/// But the replacement type does use T! -/// -/// <div rustbindgen replaces="JS_detail_MaybeWrapped" /> -pub type JS_detail_MaybeWrapped<T> = T; diff --git a/libbindgen/tests/expectations/tests/type_alias_template_specialized.rs b/libbindgen/tests/expectations/tests/type_alias_template_specialized.rs index 989f2015..11813bc6 100644 --- a/libbindgen/tests/expectations/tests/type_alias_template_specialized.rs +++ b/libbindgen/tests/expectations/tests/type_alias_template_specialized.rs @@ -17,3 +17,5 @@ fn bindgen_test_layout_Rooted() { impl Clone for Rooted { fn clone(&self) -> Self { *self } } +/// <div rustbindgen replaces="MaybeWrapped"></div> +pub type MaybeWrapped<a> = a; diff --git a/libbindgen/tests/headers/reparented_replacement.hpp b/libbindgen/tests/headers/reparented_replacement.hpp new file mode 100644 index 00000000..4ac2bf03 --- /dev/null +++ b/libbindgen/tests/headers/reparented_replacement.hpp @@ -0,0 +1,16 @@ +// bindgen-flags: --enable-cxx-namespaces + +namespace foo { + struct Bar { + int baz; + }; +} + +namespace bar { + /// <div rustbindgen replaces="foo::Bar"></div> + struct Bar_Replacement { + int bazz; + }; +}; + +typedef foo::Bar ReferencesBar; diff --git a/libbindgen/tests/headers/replace_template_alias.hpp b/libbindgen/tests/headers/replace_template_alias.hpp index b0648994..c325b5a3 100644 --- a/libbindgen/tests/headers/replace_template_alias.hpp +++ b/libbindgen/tests/headers/replace_template_alias.hpp @@ -18,6 +18,6 @@ class Rooted { /// But the replacement type does use T! /// -/// <div rustbindgen replaces="JS_detail_MaybeWrapped" /> +/// <div rustbindgen replaces="JS::detail::MaybeWrapped" /> template <typename T> using replaces_MaybeWrapped = T; diff --git a/libbindgen/tests/headers/whitelist-namespaces-basic.hpp b/libbindgen/tests/headers/whitelist-namespaces-basic.hpp index abe9dc11..2eaa8740 100644 --- a/libbindgen/tests/headers/whitelist-namespaces-basic.hpp +++ b/libbindgen/tests/headers/whitelist-namespaces-basic.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --enable-cxx-namespaces --whitelist-type outer_inner_Helper +// bindgen-flags: --enable-cxx-namespaces --whitelist-type outer::inner::Helper namespace outer { namespace inner { |