summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiting Zhu <zzhu@mozilla.com>2017-08-04 15:36:48 -0700
committerZhiting Zhu <zzhu@mozilla.com>2017-08-09 15:19:00 -0700
commite358a00e88e5d69608dd0c4967a4e2e0c78f323f (patch)
tree7186ae247848c9983e8b51ff7a4456a28d58f6d0
parentdb6a3fb3a5fe14172926a7a486244f5ef5e65d8a (diff)
Anonymous related tests for derive Hash
-rw-r--r--tests/expectations/tests/anon_enum_trait.rs4
-rw-r--r--tests/expectations/tests/anon_struct_in_union.rs9
-rw-r--r--tests/expectations/tests/anon_union.rs13
-rw-r--r--tests/headers/anon_enum.hpp1
-rw-r--r--tests/headers/anon_enum_trait.hpp1
-rw-r--r--tests/headers/anon_struct_in_union.h1
-rw-r--r--tests/headers/anon_union.hpp1
7 files changed, 20 insertions, 10 deletions
diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs
index 699d49c2..38ed0268 100644
--- a/tests/expectations/tests/anon_enum_trait.rs
+++ b/tests/expectations/tests/anon_enum_trait.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct DataType {
pub _address: u8,
}
@@ -27,7 +27,7 @@ pub const DataType_type_: DataType__bindgen_ty_1 =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum DataType__bindgen_ty_1 { generic_type = 0, }
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct Foo {
pub _address: u8,
}
diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs
index bfb10015..b4820319 100644
--- a/tests/expectations/tests/anon_struct_in_union.rs
+++ b/tests/expectations/tests/anon_struct_in_union.rs
@@ -28,19 +28,22 @@ 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 s {
pub u: s__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct s__bindgen_ty_1 {
pub field: __BindgenUnionField<s__bindgen_ty_1_inner>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Hash)]
pub struct s__bindgen_ty_1_inner {
pub b: ::std::os::raw::c_int,
}
diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs
index 97cd40f5..71c2d4f7 100644
--- a/tests/expectations/tests/anon_union.rs
+++ b/tests/expectations/tests/anon_union.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, Copy, Clone)]
+#[derive(Debug, Copy, Clone, Hash)]
pub struct TErrorResult {
pub mResult: ::std::os::raw::c_int,
pub __bindgen_anon_1: TErrorResult__bindgen_ty_1,
@@ -42,17 +45,17 @@ pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TErrorResult_UnionState { HasMessage = 0, }
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct TErrorResult_Message {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct TErrorResult_DOMExceptionInfo {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
+#[derive(Debug, Default, Copy, Clone, Hash)]
pub struct TErrorResult__bindgen_ty_1 {
pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>,
pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>,
@@ -62,7 +65,7 @@ impl Default for TErrorResult {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Hash)]
pub struct ErrorResult {
pub _base: TErrorResult,
}
diff --git a/tests/headers/anon_enum.hpp b/tests/headers/anon_enum.hpp
index 1961fe6c..1a55a8d1 100644
--- a/tests/headers/anon_enum.hpp
+++ b/tests/headers/anon_enum.hpp
@@ -1,3 +1,4 @@
+// bindgen-flags: --with-derive-hash
struct Test {
int foo;
float bar;
diff --git a/tests/headers/anon_enum_trait.hpp b/tests/headers/anon_enum_trait.hpp
index e1ec394c..22137392 100644
--- a/tests/headers/anon_enum_trait.hpp
+++ b/tests/headers/anon_enum_trait.hpp
@@ -1,3 +1,4 @@
+// bindgen-flags: --with-derive-hash
template<typename _Tp>
class DataType {
diff --git a/tests/headers/anon_struct_in_union.h b/tests/headers/anon_struct_in_union.h
index 880a8b54..2e6ac5e9 100644
--- a/tests/headers/anon_struct_in_union.h
+++ b/tests/headers/anon_struct_in_union.h
@@ -1,3 +1,4 @@
+// bindgen-flags: --with-derive-hash
struct s {
union {
struct inner {
diff --git a/tests/headers/anon_union.hpp b/tests/headers/anon_union.hpp
index 126f6a6e..26bb842f 100644
--- a/tests/headers/anon_union.hpp
+++ b/tests/headers/anon_union.hpp
@@ -1,3 +1,4 @@
+// bindgen-flags: --with-derive-hash
template<typename T>
struct TErrorResult {
enum UnionState {