summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Barnard <eabarnard@gmail.com>2015-05-06 12:28:57 +0100
committerEdward Barnard <eabarnard@gmail.com>2015-05-07 11:16:02 +0100
commit742ad9b5bf3a598f9f3d11742bf0151a8ad98582 (patch)
treea01e7d4ebe6930ea46f71034456c719f750a864b
parent37808344b0f12d9a210685e704cd2614b7ef7899 (diff)
Update tests not to require bindgen_plugin and enable testing on travis
-rw-r--r--.travis.yml2
-rw-r--r--Cargo.toml4
-rw-r--r--tests/test_builtins.rs8
-rw-r--r--tests/test_cmath.rs2
-rw-r--r--tests/test_struct.rs288
-rw-r--r--tests/test_union.rs241
-rw-r--r--tests/tests.rs5
7 files changed, 377 insertions, 173 deletions
diff --git a/.travis.yml b/.travis.yml
index d5b4a601..7c52251e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,7 @@
language: rust
rust:
- nightly
+ - beta
env:
- LLVM_VERSION=3.4
- LLVM_VERSION=3.5
@@ -13,3 +14,4 @@ install:
script:
- export LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib
- cargo build --verbose
+ - cargo test
diff --git a/Cargo.toml b/Cargo.toml
index 462ecae2..b1fea7f1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,10 +13,6 @@ log = "*"
libc = "*"
syntex_syntax = "*"
-[dev-dependencies.bindgen_plugin]
-version = "*"
-path = "./bindgen_plugin"
-
[features]
static = []
diff --git a/tests/test_builtins.rs b/tests/test_builtins.rs
index a630cce0..a19d048c 100644
--- a/tests/test_builtins.rs
+++ b/tests/test_builtins.rs
@@ -1,7 +1,9 @@
+use bindgen;
+
#[test]
fn test_builtin_va_list() {
- #[allow(non_camel_case_types)]
- mod ffi { bindgen!("headers/builtin_va_list.h", emit_builtins = true); }
- // Should test for more than compilation.
+ let bindings = bindgen::builder().header("tests/headers/builtin_va_list.h")
+ .emit_builtins().generate().unwrap().to_string();
+ assert!(bindings.contains("__builtin_va_list"));
}
diff --git a/tests/test_cmath.rs b/tests/test_cmath.rs
index 03c02ae7..564e40e3 100644
--- a/tests/test_cmath.rs
+++ b/tests/test_cmath.rs
@@ -1,3 +1,5 @@
+// Unused until we can generate code for tests
+
#[allow(dead_code, non_camel_case_types)]
pub mod ffi { bindgen!("/usr/include/math.h", link = "m"); }
diff --git a/tests/test_struct.rs b/tests/test_struct.rs
index f271421c..fb61a09c 100644
--- a/tests/test_struct.rs
+++ b/tests/test_struct.rs
@@ -1,17 +1,32 @@
-use std::default::Default;
-
use support::assert_bind_eq;
#[test]
fn with_anon_struct() {
- mod ffi { bindgen!("headers/struct_with_anon_struct.h"); }
- let mut x: ffi::Struct_foo = Default::default();
-
- x.bar.a = 1;
- x.bar.b = 2;
-
- assert_eq!(x.bar.a, 1);
- assert_eq!(x.bar.b, 2);
+ assert_bind_eq("headers/struct_with_anon_struct.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_foo {
+ pub bar: Struct_Unnamed1,
+ }
+ impl ::std::clone::Clone for Struct_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_Unnamed1 {
+ pub a: ::libc::c_int,
+ pub b: ::libc::c_int,
+ }
+ impl ::std::clone::Clone for Struct_Unnamed1 {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_Unnamed1 {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
@@ -66,78 +81,171 @@ fn with_anon_struct_array() {
#[test]
fn with_anon_struct_pointer() {
- mod ffi { bindgen!("headers/struct_with_anon_struct_pointer.h"); }
- let mut x: ffi::Struct_foo = Default::default();
- let mut unnamed: ffi::Struct_Unnamed1 = Default::default();
-
- unsafe {
- x.bar = &mut unnamed;
-
- (*x.bar).a = 1;
- (*x.bar).b = 2;
-
- assert_eq!((*x.bar).a, 1);
- assert_eq!((*x.bar).b, 2);
-
- ::std::ptr::read(x.bar);
- }
+ assert_bind_eq("headers/struct_with_anon_struct_pointer.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_foo {
+ pub bar: *mut Struct_Unnamed1,
+ }
+ impl ::std::clone::Clone for Struct_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_Unnamed1 {
+ pub a: ::libc::c_int,
+ pub b: ::libc::c_int,
+ }
+ impl ::std::clone::Clone for Struct_Unnamed1 {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_Unnamed1 {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
fn with_anon_union() {
- mod ffi { bindgen!("headers/struct_with_anon_union.h"); }
- let mut x: ffi::Struct_foo = Default::default();
-
- unsafe {
- *x.bar.a() = 0x12345678;
- assert_eq!(*x.bar.a(), 0x12345678);
- assert_eq!(*x.bar.b(), 0x5678);
- }
+ assert_bind_eq("headers/struct_with_anon_union.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_foo {
+ pub bar: Union_Unnamed1,
+ }
+ impl ::std::clone::Clone for Struct_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Union_Unnamed1 {
+ pub _bindgen_data_: [u32; 1usize],
+ }
+ impl Union_Unnamed1 {
+ pub unsafe fn a(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn b(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ }
+ impl ::std::clone::Clone for Union_Unnamed1 {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Union_Unnamed1 {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
fn with_anon_unnamed_struct() {
- mod ffi { bindgen!("headers/struct_with_anon_unnamed_struct.h"); }
- let mut x: ffi::Struct_foo = Default::default();
-
- unsafe {
- *x.a() = 0x12345678;
- *x.b() = 0x87654321;
- assert_eq!(*x.a(), 0x12345678);
- assert_eq!(*x.b(), 0x87654321);
- }
+ assert_bind_eq("headers/struct_with_anon_unnamed_struct.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_foo {
+ pub _bindgen_data_1_: [u32; 2usize],
+ }
+ impl Struct_foo {
+ pub unsafe fn a(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn b(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(4))
+ }
+ }
+ impl ::std::clone::Clone for Struct_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
fn with_anon_unnamed_union() {
- mod ffi { bindgen!("headers/struct_with_anon_unnamed_union.h"); }
- let mut x: ffi::Struct_foo = Default::default();
-
- unsafe {
- *x.a() = 0x12345678;
- assert_eq!(*x.a(), 0x12345678);
- assert_eq!(*x.b(), 0x5678);
- }
+ assert_bind_eq("headers/struct_with_anon_unnamed_union.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_foo {
+ pub _bindgen_data_1_: [u32; 1usize],
+ }
+ impl Struct_foo {
+ pub unsafe fn a(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn b(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ }
+ impl ::std::clone::Clone for Struct_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
fn with_nesting() {
- mod ffi { bindgen!("headers/struct_with_nesting.h"); }
- let mut x: ffi::Struct_foo = Default::default();
-
- unsafe {
- x.a = 0x12345678;
- *x.b() = 0x87654321;
-
- assert_eq!(x.a, 0x12345678);
- assert_eq!(*x.b(), 0x87654321);
- assert_eq!(*x.c1(), 0x4321);
- assert_eq!(*x.c2(), 0x8765);
- assert_eq!(*x.d1(), 0x21);
- assert_eq!(*x.d2(), 0x43);
- assert_eq!(*x.d3(), 0x65);
- assert_eq!(*x.d4(), 0x87);
- }
+ assert_bind_eq("headers/struct_with_nesting.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_foo {
+ pub a: ::libc::c_uint,
+ pub _bindgen_data_1_: [u32; 1usize],
+ }
+ impl Struct_foo {
+ pub unsafe fn b(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn c1(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn c2(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(2))
+ }
+ pub unsafe fn d1(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn d2(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(1))
+ }
+ pub unsafe fn d3(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(2))
+ }
+ pub unsafe fn d4(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_1_);
+ ::std::mem::transmute(raw.offset(3))
+ }
+ }
+ impl ::std::clone::Clone for Struct_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
@@ -197,29 +305,29 @@ fn with_bitfields() {
#[test]
fn with_fwd_decl_struct() {
- mod ffi { bindgen!("headers/forward_declared_struct.h"); }
-
- let a = ffi::Struct_a { b: 1 };
- let c = ffi::Struct_c { d: 1 };
-
- assert_eq!(a.b, 1);
- assert_eq!(c.d, 1);
+ assert_bind_eq("headers/forward_declared_struct.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_a {
+ pub b: ::libc::c_int,
+ }
+ 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() } }
+ }
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_c {
+ pub d: ::libc::c_int,
+ }
+ impl ::std::clone::Clone for Struct_c {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_c {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
-#[test]
-fn default_impl() {
- mod ffi { bindgen!("headers/struct_with_nesting.h"); }
-
- let mut x: ffi::Struct_foo = Default::default();
-
- unsafe {
- assert_eq!(x.a, 0);
- assert_eq!(*x.b(), 0);
- assert_eq!(*x.c1(), 0);
- assert_eq!(*x.c2(), 0);
- assert_eq!(*x.d1(), 0);
- assert_eq!(*x.d2(), 0);
- assert_eq!(*x.d3(), 0);
- assert_eq!(*x.d4(), 0);
- }
-}
diff --git a/tests/test_union.rs b/tests/test_union.rs
index c899d826..a558fe66 100644
--- a/tests/test_union.rs
+++ b/tests/test_union.rs
@@ -1,19 +1,38 @@
-use std::default::Default;
-
use support::assert_bind_eq;
#[test]
fn with_anon_struct() {
- mod ffi { bindgen!("headers/union_with_anon_struct.h"); }
- let mut x: ffi::Union_foo = Default::default();
-
- unsafe {
- (*x.bar()).a = 0x12345678;
- (*x.bar()).b = 0x87654321;
-
- assert_eq!((*x.bar()).a, 0x12345678);
- assert_eq!((*x.bar()).b, 0x87654321);
- }
+ assert_bind_eq("headers/union_with_anon_struct.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Union_foo {
+ pub _bindgen_data_: [u32; 2usize],
+ }
+ impl Union_foo {
+ pub unsafe fn bar(&mut self) -> *mut Struct_Unnamed1 {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ }
+ impl ::std::clone::Clone for Union_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Union_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Struct_Unnamed1 {
+ pub a: ::libc::c_uint,
+ pub b: ::libc::c_uint,
+ }
+ impl ::std::clone::Clone for Struct_Unnamed1 {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Struct_Unnamed1 {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
@@ -44,77 +63,153 @@ fn with_anon_struct_bitfield() {
#[test]
fn with_anon_union() {
- mod ffi { bindgen!("headers/union_with_anon_union.h"); }
- let mut x: ffi::Union_foo = Default::default();
-
- unsafe {
- *(*x.bar()).a() = 0x12345678;
-
- assert_eq!(*(*x.bar()).a(), 0x12345678);
- assert_eq!(*(*x.bar()).b(), 0x5678);
- }
+ assert_bind_eq("headers/union_with_anon_union.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Union_foo {
+ pub _bindgen_data_: [u32; 1usize],
+ }
+ impl Union_foo {
+ pub unsafe fn bar(&mut self) -> *mut Union_Unnamed1 {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ }
+ impl ::std::clone::Clone for Union_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Union_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Union_Unnamed1 {
+ pub _bindgen_data_: [u32; 1usize],
+ }
+ impl Union_Unnamed1 {
+ pub unsafe fn a(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn b(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ }
+ impl ::std::clone::Clone for Union_Unnamed1 {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Union_Unnamed1 {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
fn with_anon_unnamed_struct() {
- mod ffi { bindgen!("headers/union_with_anon_unnamed_struct.h"); }
- let mut x: ffi::Union_pixel = Default::default();
-
- unsafe {
- *x.r() = 0xca;
- *x.g() = 0xcb;
- *x.b() = 0xcc;
- *x.a() = 0xcd;
-
- assert_eq!(*x.rgba(), 0xcdcccbca);
- assert_eq!(*x.r(), 0xca);
- assert_eq!(*x.g(), 0xcb);
- assert_eq!(*x.b(), 0xcc);
- assert_eq!(*x.a(), 0xcd);
- }
+ assert_bind_eq("headers/union_with_anon_unnamed_struct.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Union_pixel {
+ pub _bindgen_data_: [u32; 1usize],
+ }
+ impl Union_pixel {
+ pub unsafe fn rgba(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn r(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn g(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(1))
+ }
+ pub unsafe fn b(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(2))
+ }
+ pub unsafe fn a(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(3))
+ }
+ }
+ impl ::std::clone::Clone for Union_pixel {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Union_pixel {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
fn with_anon_unnamed_union() {
- mod ffi { bindgen!("headers/union_with_anon_unnamed_union.h"); }
- let mut x: ffi::Union_foo = Default::default();
-
- unsafe {
- *x.a() = 0x12345678;
-
- assert_eq!(*x.a(), 0x12345678);
- assert_eq!(*x.b(), 0x5678);
- assert_eq!(*x.c(), 0x78);
- }
+ assert_bind_eq("headers/union_with_anon_unnamed_union.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Union_foo {
+ pub _bindgen_data_: [u32; 1usize],
+ }
+ impl Union_foo {
+ pub unsafe fn a(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn b(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn c(&mut self) -> *mut ::libc::c_uchar {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ }
+ impl ::std::clone::Clone for Union_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Union_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
#[test]
fn with_nesting() {
- mod ffi { bindgen!("headers/union_with_nesting.h"); }
- let mut x: ffi::Union_foo = Default::default();
-
- unsafe {
- *x.a() = 0x12345678;
-
- assert_eq!(*x.a(), 0x12345678);
- assert_eq!(*x.b1(), 0x5678);
- assert_eq!(*x.b2(), 0x5678);
- assert_eq!(*x.c1(), 0x1234);
- assert_eq!(*x.c2(), 0x1234);
- }
-}
-
-#[test]
-fn default_impl() {
- mod ffi { bindgen!("headers/Union_with_nesting.h"); }
-
- let mut x: ffi::Union_foo = Default::default();
-
- unsafe {
- assert_eq!(*x.a(), 0);
- assert_eq!(*x.b1(), 0);
- assert_eq!(*x.b2(), 0);
- assert_eq!(*x.c1(), 0);
- assert_eq!(*x.c2(), 0);
- }
+ assert_bind_eq("headers/union_with_nesting.h", "
+ #[repr(C)]
+ #[derive(Copy)]
+ pub struct Union_foo {
+ pub _bindgen_data_: [u32; 1usize],
+ }
+ impl Union_foo {
+ pub unsafe fn a(&mut self) -> *mut ::libc::c_uint {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn b1(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn b2(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn c1(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(2))
+ }
+ pub unsafe fn c2(&mut self) -> *mut ::libc::c_ushort {
+ let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
+ ::std::mem::transmute(raw.offset(2))
+ }
+ }
+ impl ::std::clone::Clone for Union_foo {
+ fn clone(&self) -> Self { *self }
+ }
+ impl ::std::default::Default for Union_foo {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ }
+ ");
}
diff --git a/tests/tests.rs b/tests/tests.rs
index 669f5623..b9a4f61c 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -1,5 +1,3 @@
-#![feature(plugin)]
-#![plugin(bindgen_plugin)]
#![allow(dead_code)]
extern crate bindgen;
@@ -8,7 +6,8 @@ extern crate syntex_syntax as syntax;
mod support;
-mod test_cmath;
+// Unused until we can generate code for tests
+//mod test_cmath;
mod test_decl;
mod test_func;
mod test_struct;