diff options
author | Zhiting Zhu <zzhu@mozilla.com> | 2017-08-11 11:13:34 -0700 |
---|---|---|
committer | Zhiting Zhu <zzhu@mozilla.com> | 2017-08-14 10:19:14 -0700 |
commit | 3e5b9de1b9eeab0c35d88e14f4cc02ad0c79aa29 (patch) | |
tree | e537c59c7ed4b6079d45e3f4e0cce35e3eb7e260 | |
parent | 919cbbac48557940b5a197f6f350df40333e39ad (diff) |
Anonymous related tests for derive PartialEq
-rw-r--r-- | tests/expectations/tests/anon_enum.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/anon_enum_trait.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/anon_struct_in_union.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/anon_struct_in_union_1_0.rs | 9 | ||||
-rw-r--r-- | tests/expectations/tests/anon_union.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/anon_union_1_0.rs | 13 | ||||
-rw-r--r-- | tests/headers/anon_enum.hpp | 2 | ||||
-rw-r--r-- | tests/headers/anon_enum_trait.hpp | 2 | ||||
-rw-r--r-- | tests/headers/anon_struct_in_union.h | 2 | ||||
-rw-r--r-- | tests/headers/anon_struct_in_union_1_0.h | 2 | ||||
-rw-r--r-- | tests/headers/anon_union.hpp | 3 | ||||
-rw-r--r-- | tests/headers/anon_union_1_0.hpp | 2 |
12 files changed, 26 insertions, 21 deletions
diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs index 715688ff..b1004274 100644 --- a/tests/expectations/tests/anon_enum.rs +++ b/tests/expectations/tests/anon_enum.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, PartialEq)] pub struct Test { pub foo: ::std::os::raw::c_int, pub bar: f32, diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs index 38ed0268..c2ae221b 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, Hash)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] 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, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] 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 02a3d314..9dbf30de 100644 --- a/tests/expectations/tests/anon_struct_in_union.rs +++ b/tests/expectations/tests/anon_struct_in_union.rs @@ -16,7 +16,7 @@ pub union s__bindgen_ty_1 { _bindgen_union_align: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct s__bindgen_ty_1_inner { pub b: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/anon_struct_in_union_1_0.rs b/tests/expectations/tests/anon_struct_in_union_1_0.rs index b4820319..74b6fe4a 100644 --- a/tests/expectations/tests/anon_struct_in_union_1_0.rs +++ b/tests/expectations/tests/anon_struct_in_union_1_0.rs @@ -31,19 +31,22 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { impl <T> ::std::hash::Hash for __BindgenUnionField<T> { fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { } } +impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { + fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } +} #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct s { pub u: s__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] 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, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] 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 d1c51f29..a055cbe5 100644 --- a/tests/expectations/tests/anon_union.rs +++ b/tests/expectations/tests/anon_union.rs @@ -17,12 +17,12 @@ 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, Hash)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] pub struct TErrorResult_Message { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] pub struct TErrorResult_DOMExceptionInfo { pub _address: u8, } diff --git a/tests/expectations/tests/anon_union_1_0.rs b/tests/expectations/tests/anon_union_1_0.rs index 71c2d4f7..64a17776 100644 --- a/tests/expectations/tests/anon_union_1_0.rs +++ b/tests/expectations/tests/anon_union_1_0.rs @@ -31,8 +31,11 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { impl <T> ::std::hash::Hash for __BindgenUnionField<T> { fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { } } +impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { + fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } +} #[repr(C)] -#[derive(Debug, Copy, Clone, Hash)] +#[derive(Debug, Copy, Clone, Hash, PartialEq)] pub struct TErrorResult { pub mResult: ::std::os::raw::c_int, pub __bindgen_anon_1: TErrorResult__bindgen_ty_1, @@ -45,17 +48,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, Hash)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] pub struct TErrorResult_Message { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] pub struct TErrorResult_DOMExceptionInfo { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] pub struct TErrorResult__bindgen_ty_1 { pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>, pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>, @@ -65,7 +68,7 @@ impl Default for TErrorResult { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash)] +#[derive(Debug, Copy, Hash, PartialEq)] pub struct ErrorResult { pub _base: TErrorResult, } diff --git a/tests/headers/anon_enum.hpp b/tests/headers/anon_enum.hpp index 1a55a8d1..48df3c7a 100644 --- a/tests/headers/anon_enum.hpp +++ b/tests/headers/anon_enum.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq struct Test { int foo; float bar; diff --git a/tests/headers/anon_enum_trait.hpp b/tests/headers/anon_enum_trait.hpp index 22137392..7d164054 100644 --- a/tests/headers/anon_enum_trait.hpp +++ b/tests/headers/anon_enum_trait.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq template<typename _Tp> class DataType { diff --git a/tests/headers/anon_struct_in_union.h b/tests/headers/anon_struct_in_union.h index 2e6ac5e9..98d55056 100644 --- a/tests/headers/anon_struct_in_union.h +++ b/tests/headers/anon_struct_in_union.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq struct s { union { struct inner { diff --git a/tests/headers/anon_struct_in_union_1_0.h b/tests/headers/anon_struct_in_union_1_0.h index 5e5023ba..86e5ca73 100644 --- a/tests/headers/anon_struct_in_union_1_0.h +++ b/tests/headers/anon_struct_in_union_1_0.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq struct s { union { diff --git a/tests/headers/anon_union.hpp b/tests/headers/anon_union.hpp index 250dcb1a..ca1d3bc1 100644 --- a/tests/headers/anon_union.hpp +++ b/tests/headers/anon_union.hpp @@ -1,5 +1,4 @@ -// bindgen-flags: --with-derive-hash - +// bindgen-flags: --with-derive-hash --with-derive-partialeq template<typename T> struct TErrorResult { enum UnionState { diff --git a/tests/headers/anon_union_1_0.hpp b/tests/headers/anon_union_1_0.hpp index 33ab48ca..1a5e2b0d 100644 --- a/tests/headers/anon_union_1_0.hpp +++ b/tests/headers/anon_union_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq template<typename T> struct TErrorResult { |