eth/tracers/logger: error comparison test

This commit is contained in:
Martin 2025-01-10 15:51:44 -05:00
parent 4920d8127f
commit 7b3cb25847

View file

@ -108,3 +108,18 @@ func TestStructLogMarshalingOmitEmpty(t *testing.T) {
})
}
}
func TestErrorCompare(t *testing.T) {
err := vm.ErrExecutionReverted
if err != vm.ErrExecutionReverted {
t.Fatal("error compare")
}
// wrap err and test again
err = vm.VMErrorFromErr(err)
if err == vm.ErrExecutionReverted { // equality comparison fails
t.Fatal("error compare should fail")
}
if !errors.Is(err, vm.ErrExecutionReverted) { // check all wrapped errors
t.Fatal("error compare: err is not a vm.ErrExecutionReverted")
}
}