Skip to content

Commit 3e5b9de

Browse files
author
Zhiting Zhu
committed
Anonymous related tests for derive PartialEq
1 parent 919cbba commit 3e5b9de

12 files changed

+26
-21
lines changed

tests/expectations/tests/anon_enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
#[repr(C)]
8-
#[derive(Debug, Default, Copy)]
8+
#[derive(Debug, Default, Copy, PartialEq)]
99
pub struct Test {
1010
pub foo: ::std::os::raw::c_int,
1111
pub bar: f32,

tests/expectations/tests/anon_enum_trait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
#[repr(C)]
8-
#[derive(Debug, Default, Copy, Clone, Hash)]
8+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
99
pub struct DataType {
1010
pub _address: u8,
1111
}
@@ -27,7 +27,7 @@ pub const DataType_type_: DataType__bindgen_ty_1 =
2727
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2828
pub enum DataType__bindgen_ty_1 { generic_type = 0, }
2929
#[repr(C)]
30-
#[derive(Debug, Default, Copy, Hash)]
30+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
3131
pub struct Foo {
3232
pub _address: u8,
3333
}

tests/expectations/tests/anon_struct_in_union.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub union s__bindgen_ty_1 {
1616
_bindgen_union_align: u32,
1717
}
1818
#[repr(C)]
19-
#[derive(Debug, Default, Copy, Hash)]
19+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
2020
pub struct s__bindgen_ty_1_inner {
2121
pub b: ::std::os::raw::c_int,
2222
}

tests/expectations/tests/anon_struct_in_union_1_0.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,22 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
3131
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3232
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
3333
}
34+
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
35+
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
36+
}
3437
#[repr(C)]
35-
#[derive(Debug, Default, Copy, Hash)]
38+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
3639
pub struct s {
3740
pub u: s__bindgen_ty_1,
3841
}
3942
#[repr(C)]
40-
#[derive(Debug, Default, Copy, Hash)]
43+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
4144
pub struct s__bindgen_ty_1 {
4245
pub field: __BindgenUnionField<s__bindgen_ty_1_inner>,
4346
pub bindgen_union_field: u32,
4447
}
4548
#[repr(C)]
46-
#[derive(Debug, Default, Copy, Hash)]
49+
#[derive(Debug, Default, Copy, Hash, PartialEq)]
4750
pub struct s__bindgen_ty_1_inner {
4851
pub b: ::std::os::raw::c_int,
4952
}

tests/expectations/tests/anon_union.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
1717
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1818
pub enum TErrorResult_UnionState { HasMessage = 0, }
1919
#[repr(C)]
20-
#[derive(Debug, Default, Copy, Clone, Hash)]
20+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
2121
pub struct TErrorResult_Message {
2222
pub _address: u8,
2323
}
2424
#[repr(C)]
25-
#[derive(Debug, Default, Copy, Clone, Hash)]
25+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
2626
pub struct TErrorResult_DOMExceptionInfo {
2727
pub _address: u8,
2828
}

tests/expectations/tests/anon_union_1_0.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
3131
impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3232
fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { }
3333
}
34+
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
35+
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
36+
}
3437
#[repr(C)]
35-
#[derive(Debug, Copy, Clone, Hash)]
38+
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
3639
pub struct TErrorResult {
3740
pub mResult: ::std::os::raw::c_int,
3841
pub __bindgen_anon_1: TErrorResult__bindgen_ty_1,
@@ -45,17 +48,17 @@ pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
4548
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
4649
pub enum TErrorResult_UnionState { HasMessage = 0, }
4750
#[repr(C)]
48-
#[derive(Debug, Default, Copy, Clone, Hash)]
51+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
4952
pub struct TErrorResult_Message {
5053
pub _address: u8,
5154
}
5255
#[repr(C)]
53-
#[derive(Debug, Default, Copy, Clone, Hash)]
56+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
5457
pub struct TErrorResult_DOMExceptionInfo {
5558
pub _address: u8,
5659
}
5760
#[repr(C)]
58-
#[derive(Debug, Default, Copy, Clone, Hash)]
61+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
5962
pub struct TErrorResult__bindgen_ty_1 {
6063
pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>,
6164
pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>,
@@ -65,7 +68,7 @@ impl Default for TErrorResult {
6568
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
6669
}
6770
#[repr(C)]
68-
#[derive(Debug, Copy, Hash)]
71+
#[derive(Debug, Copy, Hash, PartialEq)]
6972
pub struct ErrorResult {
7073
pub _base: TErrorResult,
7174
}

tests/headers/anon_enum.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
22
struct Test {
33
int foo;
44
float bar;

tests/headers/anon_enum_trait.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
22

33
template<typename _Tp>
44
class DataType {

tests/headers/anon_struct_in_union.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
22
struct s {
33
union {
44
struct inner {

tests/headers/anon_struct_in_union_1_0.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
22

33
struct s {
44
union {

tests/headers/anon_union.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// bindgen-flags: --with-derive-hash
2-
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq
32
template<typename T>
43
struct TErrorResult {
54
enum UnionState {

tests/headers/anon_union_1_0.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
22

33
template<typename T>
44
struct TErrorResult {

0 commit comments

Comments
 (0)