diff options
Diffstat (limited to 'libbindgen/tests')
10 files changed, 112 insertions, 13 deletions
diff --git a/libbindgen/tests/expectations/tests/maddness-is-avoidable.rs b/libbindgen/tests/expectations/tests/maddness-is-avoidable.rs new file mode 100644 index 00000000..d31345ba --- /dev/null +++ b/libbindgen/tests/expectations/tests/maddness-is-avoidable.rs @@ -0,0 +1,20 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct RefPtr<T> { + pub _address: u8, + pub _phantom_0: ::std::marker::PhantomData<T>, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct RefPtr_Proxy<T, R, Args> { + pub _address: u8, + pub _phantom_0: ::std::marker::PhantomData<T>, + pub _phantom_1: ::std::marker::PhantomData<R>, + pub _phantom_2: ::std::marker::PhantomData<Args>, +} diff --git a/libbindgen/tests/expectations/tests/module-whitelisted.rs b/libbindgen/tests/expectations/tests/module-whitelisted.rs new file mode 100644 index 00000000..7e63c8c8 --- /dev/null +++ b/libbindgen/tests/expectations/tests/module-whitelisted.rs @@ -0,0 +1,23 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub mod root { + #[allow(unused_imports)] + use root; + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Test { + pub _address: u8, + } + #[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/expectations/tests/namespace.rs b/libbindgen/tests/expectations/tests/namespace.rs index abb48204..54bc08dc 100644 --- a/libbindgen/tests/expectations/tests/namespace.rs +++ b/libbindgen/tests/expectations/tests/namespace.rs @@ -76,15 +76,3 @@ pub mod root { } } } -extern "C" { - #[link_name = "_Z9top_levelv"] - pub fn top_level(); -} -#[repr(C)] -#[derive(Debug)] -pub struct C<T> { - pub _base: root::_bindgen_mod_id_13::A, - pub m_c: T, - pub m_c_ptr: *mut T, - pub m_c_arr: [T; 10usize], -} diff --git a/libbindgen/tests/expectations/tests/replace_use.rs b/libbindgen/tests/expectations/tests/replace_use.rs new file mode 100644 index 00000000..f4fee442 --- /dev/null +++ b/libbindgen/tests/expectations/tests/replace_use.rs @@ -0,0 +1,28 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +/** + * <div rustbindgen replaces="nsTArray"></div> + */ +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct nsTArray<T> { + pub y: ::std::os::raw::c_uint, + pub _phantom_0: ::std::marker::PhantomData<T>, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Test { + pub a: nsTArray<::std::os::raw::c_long>, +} +#[test] +fn bindgen_test_layout_Test() { + assert_eq!(::std::mem::size_of::<Test>() , 4usize); + assert_eq!(::std::mem::align_of::<Test>() , 4usize); +} +impl Clone for Test { + fn clone(&self) -> Self { *self } +} diff --git a/libbindgen/tests/expectations/tests/whitelist_fix.rs b/libbindgen/tests/expectations/tests/whitelist_fix.rs new file mode 100644 index 00000000..9e26e1be --- /dev/null +++ b/libbindgen/tests/expectations/tests/whitelist_fix.rs @@ -0,0 +1,10 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + +pub enum Test {} + +extern "C" { + pub fn Servo_Test(a: *mut Test); +} diff --git a/libbindgen/tests/headers/maddness-is-avoidable.hpp b/libbindgen/tests/headers/maddness-is-avoidable.hpp new file mode 100644 index 00000000..46d7495e --- /dev/null +++ b/libbindgen/tests/headers/maddness-is-avoidable.hpp @@ -0,0 +1,9 @@ +// bindgen-flags: --blacklist-type RefPtr_Proxy_member_function + +template<typename T> +class RefPtr { + template<typename R, typename... Args> + class Proxy { + typedef R (T::*member_function)(Args...); + }; +}; diff --git a/libbindgen/tests/headers/module-whitelisted.hpp b/libbindgen/tests/headers/module-whitelisted.hpp new file mode 100644 index 00000000..f41e874e --- /dev/null +++ b/libbindgen/tests/headers/module-whitelisted.hpp @@ -0,0 +1,2 @@ +// bindgen-flags: --enable-cxx-namespaces +struct Test {}; diff --git a/libbindgen/tests/headers/replace_use.hpp b/libbindgen/tests/headers/replace_use.hpp new file mode 100644 index 00000000..de44eb19 --- /dev/null +++ b/libbindgen/tests/headers/replace_use.hpp @@ -0,0 +1,15 @@ +template<typename T> +struct nsTArray { + int x; +}; +/** + * <div rustbindgen replaces="nsTArray"></div> + */ +template<typename T> +struct nsTArray_Simple { + unsigned int y; +}; + +struct Test { + nsTArray<long> a; +}; diff --git a/libbindgen/tests/headers/whitelist-namespaces-basic.hpp b/libbindgen/tests/headers/whitelist-namespaces-basic.hpp index b631d290..abe9dc11 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 '.*Helper' +// bindgen-flags: --enable-cxx-namespaces --whitelist-type outer_inner_Helper namespace outer { namespace inner { diff --git a/libbindgen/tests/headers/whitelist_fix.hpp b/libbindgen/tests/headers/whitelist_fix.hpp new file mode 100644 index 00000000..d0abda54 --- /dev/null +++ b/libbindgen/tests/headers/whitelist_fix.hpp @@ -0,0 +1,4 @@ +// bindgen-flags: --whitelist-function 'Servo_.*' --blacklist-type Test --raw-line "pub enum Test {}" + +struct Test {}; +extern "C" void Servo_Test(Test* a); |