diff options
author | Ilkka Rauta <ilkka.rauta@gmail.com> | 2015-07-29 16:22:09 +0300 |
---|---|---|
committer | Ilkka Rauta <ilkka.rauta@gmail.com> | 2015-07-29 16:22:34 +0300 |
commit | 740fe6db8e8d183e24a2bd3ab56b8757955544b7 (patch) | |
tree | 31b315a44036970a8e17ccf72426e80aab0b3c16 /tests/test_struct.rs | |
parent | 5bd9f05a5c9d907e92be6df4aa28e655bacf3df7 (diff) |
Add test for 'packed' attribute.
Diffstat (limited to 'tests/test_struct.rs')
-rw-r--r-- | tests/test_struct.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_struct.rs b/tests/test_struct.rs index fb61a09c..37424530 100644 --- a/tests/test_struct.rs +++ b/tests/test_struct.rs @@ -331,3 +331,22 @@ fn with_fwd_decl_struct() { "); } + +#[test] +fn packed_struct() { + assert_bind_eq("headers/struct_with_packing.h", " + #[repr(C, packed)] + #[derive(Copy)] + pub struct Struct_a { + pub b: ::libc::c_char, + pub c: ::libc::c_short, + } + impl ::std::clone::Clone for Struct_a { + fn clone(&self) -> Self { *self } + } + impl ::std::default::Default for Struct_a { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } + } + "); +} + |