diff options
author | Sébastien Duquette <ekse.0x@gmail.com> | 2018-11-10 20:32:29 -0500 |
---|---|---|
committer | Sébastien Duquette <ekse.0x@gmail.com> | 2018-11-10 20:32:29 -0500 |
commit | 5b741da6e9a4a0737df37cb04a8adee0d30224df (patch) | |
tree | 47de1c449f693f68c442fdf6e72342c9724ef1ea | |
parent | c5c13535ff058e2c0aff3d1d0b5b08ae04fdc237 (diff) |
Add tests for renamed structure items
-rw-r--r-- | bindgen-integration/cpp/Test.cc | 6 | ||||
-rw-r--r-- | bindgen-integration/cpp/Test.h | 11 | ||||
-rwxr-xr-x | bindgen-integration/src/lib.rs | 6 |
3 files changed, 18 insertions, 5 deletions
diff --git a/bindgen-integration/cpp/Test.cc b/bindgen-integration/cpp/Test.cc index 03981eaf..c3d73411 100644 --- a/bindgen-integration/cpp/Test.cc +++ b/bindgen-integration/cpp/Test.cc @@ -130,8 +130,8 @@ Seventh::assert(bool first, this->seventh_thirty_bits == seventh; }; +} // namespace bitfields + int my_prefixed_function_name() { return 4; -} - -} // namespace bitfields +}
\ No newline at end of file diff --git a/bindgen-integration/cpp/Test.h b/bindgen-integration/cpp/Test.h index 10f1b57f..fe9bf0d4 100644 --- a/bindgen-integration/cpp/Test.h +++ b/bindgen-integration/cpp/Test.h @@ -179,6 +179,15 @@ struct WithWChar { wchar_t foo[30]; }; +// The names of the following items are unprefixed by the parse callbacks. const int MY_PREFIXED_CONST_VALUE = 3; -int my_prefixed_function_name();
\ No newline at end of file +int my_prefixed_function_name(); + +struct my_prefixed_bar { + int foo; +}; + +struct my_prefixed_foo { + my_prefixed_bar member; +}; diff --git a/bindgen-integration/src/lib.rs b/bindgen-integration/src/lib.rs index c37ed335..0e051df3 100755 --- a/bindgen-integration/src/lib.rs +++ b/bindgen-integration/src/lib.rs @@ -286,5 +286,9 @@ fn test_virtual_dtor() { #[test] fn test_item_rename() { assert_eq!(bindings::CONST_VALUE, 3); - assert_eq!(bindings::function_name(), 4); + assert_eq!(unsafe{ bindings::function_name() }, 4); + + let _foo = bindings::foo{ + member: bindings::bar{foo: 2} + }; }
\ No newline at end of file |