summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorzzhu <zzhu@mozilla.com>2017-08-02 11:23:27 -0700
committerZhiting Zhu <zzhu@mozilla.com>2017-08-09 15:19:00 -0700
commite5e69058910dcad1680754a2932c11c931d9ab2d (patch)
tree2a72a185b21f1f18d2356a91c5314be9303875f2 /tests
parent923ee36d64039b83b0a9ffce7b92e1602fc79abd (diff)
Union related tests for derive Hash
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/tests/union-in-ns.rs3
-rw-r--r--tests/expectations/tests/union_dtor.rs3
-rw-r--r--tests/expectations/tests/union_fields.rs5
-rw-r--r--tests/expectations/tests/union_template.rs11
-rw-r--r--tests/expectations/tests/union_with_anon_struct.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_struct_bitfield.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_union.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_struct.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_union.rs7
-rw-r--r--tests/expectations/tests/union_with_big_member.rs5
-rw-r--r--tests/expectations/tests/union_with_nesting.rs11
-rw-r--r--tests/headers/union_fields.hpp2
-rw-r--r--tests/headers/union_template.hpp2
-rw-r--r--tests/headers/union_with_anon_struct.h2
-rw-r--r--tests/headers/union_with_anon_struct_bitfield.h2
-rw-r--r--tests/headers/union_with_anon_union.h2
-rw-r--r--tests/headers/union_with_anon_unnamed_struct.h2
-rw-r--r--tests/headers/union_with_anon_unnamed_union.h2
-rw-r--r--tests/headers/union_with_big_member.h2
-rw-r--r--tests/headers/union_with_nesting.h2
20 files changed, 71 insertions, 20 deletions
diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs
index 8beb7a92..968b1f83 100644
--- a/tests/expectations/tests/union-in-ns.rs
+++ b/tests/expectations/tests/union-in-ns.rs
@@ -34,6 +34,9 @@ pub mod root {
fmt.write_str("__BindgenUnionField")
}
}
+ impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+ }
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs
index 429ec082..6f7eba41 100644
--- a/tests/expectations/tests/union_dtor.rs
+++ b/tests/expectations/tests/union_dtor.rs
@@ -28,6 +28,9 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
#[derive(Debug, Default)]
pub struct UnionWithDtor {
diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs
index 45ce6473..fd4ac5ab 100644
--- a/tests/expectations/tests/union_fields.rs
+++ b/tests/expectations/tests/union_fields.rs
@@ -28,8 +28,11 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct nsStyleUnion {
pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
pub mFloat: __BindgenUnionField<f32>,
diff --git a/tests/expectations/tests/union_template.rs b/tests/expectations/tests/union_template.rs
index 7f30e7b4..df5e87ee 100644
--- a/tests/expectations/tests/union_template.rs
+++ b/tests/expectations/tests/union_template.rs
@@ -28,29 +28,32 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct NastyStruct {
pub mIsSome: bool,
pub mStorage: NastyStruct__bindgen_ty_1,
pub __bindgen_anon_1: NastyStruct__bindgen_ty_2,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct NastyStruct__bindgen_ty_1 {
pub mFoo: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub mDummy: __BindgenUnionField<::std::os::raw::c_ulong>,
pub bindgen_union_field: u64,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct NastyStruct__bindgen_ty_2 {
pub wat: __BindgenUnionField<::std::os::raw::c_short>,
pub wut: __BindgenUnionField<*mut ::std::os::raw::c_int>,
pub bindgen_union_field: u64,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct Whatever {
pub mTPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
index f0bb68d5..5afaa876 100644
--- a/tests/expectations/tests/union_with_anon_struct.rs
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -28,14 +28,17 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo {
pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: [u32; 2usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_uint,
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
index e6acd105..ba1cdf47 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -28,15 +28,18 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo__bindgen_ty_1 {
pub _bitfield_1: u32,
pub __bindgen_align: [u32; 0usize],
diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs
index 668160a7..99c0c817 100644
--- a/tests/expectations/tests/union_with_anon_union.rs
+++ b/tests/expectations/tests/union_with_anon_union.rs
@@ -28,14 +28,17 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo {
pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo__bindgen_ty_1 {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
index 98524422..afe12dce 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -28,15 +28,18 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct pixel {
pub rgba: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct pixel__bindgen_ty_1 {
pub r: ::std::os::raw::c_uchar,
pub g: ::std::os::raw::c_uchar,
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs
index 1a6f5f45..67dcd521 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs
@@ -28,15 +28,18 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo__bindgen_ty_1 {
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c: __BindgenUnionField<::std::os::raw::c_uchar>,
diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs
index 679832fd..836fe1a5 100644
--- a/tests/expectations/tests/union_with_big_member.rs
+++ b/tests/expectations/tests/union_with_big_member.rs
@@ -28,6 +28,9 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
#[derive(Copy)]
pub struct WithBigArray {
@@ -59,7 +62,7 @@ impl Default for WithBigArray {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct WithBigArray2 {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub b: __BindgenUnionField<[::std::os::raw::c_char; 33usize]>,
diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs
index 7e32f0c0..59caccf4 100644
--- a/tests/expectations/tests/union_with_nesting.rs
+++ b/tests/expectations/tests/union_with_nesting.rs
@@ -28,21 +28,24 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt.write_str("__BindgenUnionField")
}
}
+impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
+ fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
+}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo__bindgen_ty_1 {
pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo__bindgen_ty_1__bindgen_ty_1 {
pub b1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub b2: __BindgenUnionField<::std::os::raw::c_ushort>,
@@ -75,7 +78,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct foo__bindgen_ty_1__bindgen_ty_2 {
pub c1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c2: __BindgenUnionField<::std::os::raw::c_ushort>,
diff --git a/tests/headers/union_fields.hpp b/tests/headers/union_fields.hpp
index aec3a7fd..cc8fcbe4 100644
--- a/tests/headers/union_fields.hpp
+++ b/tests/headers/union_fields.hpp
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
typedef union {
int mInt;
float mFloat;
diff --git a/tests/headers/union_template.hpp b/tests/headers/union_template.hpp
index 0d0a9bb3..f330f6b2 100644
--- a/tests/headers/union_template.hpp
+++ b/tests/headers/union_template.hpp
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
template<typename T>
struct NastyStruct {
bool mIsSome;
diff --git a/tests/headers/union_with_anon_struct.h b/tests/headers/union_with_anon_struct.h
index 7f8dec95..48adae8b 100644
--- a/tests/headers/union_with_anon_struct.h
+++ b/tests/headers/union_with_anon_struct.h
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
union foo {
struct {
unsigned int a;
diff --git a/tests/headers/union_with_anon_struct_bitfield.h b/tests/headers/union_with_anon_struct_bitfield.h
index 9668ce40..027a99eb 100644
--- a/tests/headers/union_with_anon_struct_bitfield.h
+++ b/tests/headers/union_with_anon_struct_bitfield.h
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
union foo {
int a;
struct {
diff --git a/tests/headers/union_with_anon_union.h b/tests/headers/union_with_anon_union.h
index 212431b8..b2b6fc12 100644
--- a/tests/headers/union_with_anon_union.h
+++ b/tests/headers/union_with_anon_union.h
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
union foo {
union {
unsigned int a;
diff --git a/tests/headers/union_with_anon_unnamed_struct.h b/tests/headers/union_with_anon_unnamed_struct.h
index 79558049..70ae15fe 100644
--- a/tests/headers/union_with_anon_unnamed_struct.h
+++ b/tests/headers/union_with_anon_unnamed_struct.h
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
union pixel {
unsigned int rgba;
struct {
diff --git a/tests/headers/union_with_anon_unnamed_union.h b/tests/headers/union_with_anon_unnamed_union.h
index 7580771a..10443609 100644
--- a/tests/headers/union_with_anon_unnamed_union.h
+++ b/tests/headers/union_with_anon_unnamed_union.h
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
union foo {
unsigned int a;
union {
diff --git a/tests/headers/union_with_big_member.h b/tests/headers/union_with_big_member.h
index 6347d6ca..abc0062e 100644
--- a/tests/headers/union_with_big_member.h
+++ b/tests/headers/union_with_big_member.h
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
union WithBigArray {
int a;
int b[33];
diff --git a/tests/headers/union_with_nesting.h b/tests/headers/union_with_nesting.h
index cd907d57..e40f5212 100644
--- a/tests/headers/union_with_nesting.h
+++ b/tests/headers/union_with_nesting.h
@@ -1,3 +1,5 @@
+// bindgen-flags: --with-derive-hash
+//
union foo {
unsigned int a;
struct {