diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-12 16:11:43 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-13 14:33:01 +0100 |
commit | 883ff74e5f20b68b41f322daa582d9208eece65a (patch) | |
tree | 10f0c8aa40dad4a9b48d8a705761074fff9036d3 /libbindgen/tests | |
parent | 5d9c48e59b49135db1ecfd4ff8c3dbab8ed05086 (diff) |
Add support for constructors, and integration tests.
Diffstat (limited to 'libbindgen/tests')
-rw-r--r-- | libbindgen/tests/expectations/tests/constructors.rs | 67 | ||||
-rw-r--r-- | libbindgen/tests/headers/constructors.hpp | 13 |
2 files changed, 80 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/constructors.rs b/libbindgen/tests/expectations/tests/constructors.rs new file mode 100644 index 00000000..80c14057 --- /dev/null +++ b/libbindgen/tests/expectations/tests/constructors.rs @@ -0,0 +1,67 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Copy)] +pub struct TestOverload { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_TestOverload() { + assert_eq!(::std::mem::size_of::<TestOverload>() , 1usize); + assert_eq!(::std::mem::align_of::<TestOverload>() , 1usize); +} +extern "C" { + #[link_name = "_ZN12TestOverloadC1Ei"] + pub fn TestOverload_TestOverload(this: *mut TestOverload, + arg1: ::std::os::raw::c_int); +} +extern "C" { + #[link_name = "_ZN12TestOverloadC1Ed"] + pub fn TestOverload_TestOverload1(this: *mut TestOverload, arg1: f64); +} +impl Clone for TestOverload { + fn clone(&self) -> Self { *self } +} +impl TestOverload { + #[inline] + pub unsafe fn new(arg1: ::std::os::raw::c_int) -> Self { + let mut tmp = ::std::mem::uninitialized(); + TestOverload_TestOverload(&mut tmp, arg1); + tmp + } + #[inline] + pub unsafe fn new1(arg1: f64) -> Self { + let mut tmp = ::std::mem::uninitialized(); + TestOverload_TestOverload1(&mut tmp, arg1); + tmp + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct TestPublicNoArgs { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_TestPublicNoArgs() { + assert_eq!(::std::mem::size_of::<TestPublicNoArgs>() , 1usize); + assert_eq!(::std::mem::align_of::<TestPublicNoArgs>() , 1usize); +} +extern "C" { + #[link_name = "_ZN16TestPublicNoArgsC1Ev"] + pub fn TestPublicNoArgs_TestPublicNoArgs(this: *mut TestPublicNoArgs); +} +impl Clone for TestPublicNoArgs { + fn clone(&self) -> Self { *self } +} +impl TestPublicNoArgs { + #[inline] + pub unsafe fn new() -> Self { + let mut tmp = ::std::mem::uninitialized(); + TestPublicNoArgs_TestPublicNoArgs(&mut tmp); + tmp + } +} diff --git a/libbindgen/tests/headers/constructors.hpp b/libbindgen/tests/headers/constructors.hpp new file mode 100644 index 00000000..d4174889 --- /dev/null +++ b/libbindgen/tests/headers/constructors.hpp @@ -0,0 +1,13 @@ + +class TestOverload { + // This one shouldnt' be generated. + TestOverload(); +public: + TestOverload(int); + TestOverload(double); +}; + +class TestPublicNoArgs { +public: + TestPublicNoArgs(); +}; |