mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
Revert "Change sszutil DeepEqual to ignore unexported fields" (#8391)
* Revert "Change sszutil DeepEqual to ignore unexported (#8336)"
This reverts commit 8d986bd414
.
* Add back tests, make tests have equal and non equal check
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
afa5b5e790
commit
48ae49765e
@ -109,13 +109,7 @@ func deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool, depth int) boo
|
||||
return deepValueEqual(v1.Elem(), v2.Elem(), visited, depth+1)
|
||||
case reflect.Struct:
|
||||
for i, n := 0, v1.NumField(); i < n; i++ {
|
||||
v1Field := v1.Field(i)
|
||||
v2Field := v2.Field(i)
|
||||
if !v1Field.CanInterface() || !v2Field.CanInterface() {
|
||||
// Continue for unexported fields, since they cannot be read anyways.
|
||||
continue
|
||||
}
|
||||
if !deepValueEqual(v1Field, v2Field, visited, depth+1) {
|
||||
if !deepValueEqual(v1.Field(i), v2.Field(i), visited, depth+1) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func TestDeepEqualStructs_Unexported(t *testing.T) {
|
||||
ignoreMe string
|
||||
}
|
||||
store1 := Store{uint64(1234), nil, "hi there"}
|
||||
store2 := Store{uint64(1234), []byte{}, "oh hey"}
|
||||
store2 := Store{uint64(1234), []byte{}, "hi there"}
|
||||
store3 := Store{uint64(4321), []byte{}, "wow"}
|
||||
assert.Equal(t, true, sszutil.DeepEqual(store1, store2))
|
||||
assert.Equal(t, false, sszutil.DeepEqual(store1, store3))
|
||||
|
Loading…
Reference in New Issue
Block a user