mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Add test for DoCall when ApplyMessage returns nil
This commit is contained in:
parent
ebe1ab2b54
commit
93baf1e05e
2 changed files with 21 additions and 3 deletions
1
go-ethereum
Submodule
1
go-ethereum
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit dd7daace9ddc5e02bd23aeb5fbced9fda20b1ab5
|
||||||
|
|
@ -177,4 +177,21 @@ func (m *mockBackend) EVM(ctx context.Context, msg Message, state *state.StateDB
|
||||||
func TestDoCall_ApplyMessageReturnsNil(t *testing.T) {
|
func TestDoCall_ApplyMessageReturnsNil(t *testing.T) {
|
||||||
backend := &mockBackend{
|
backend := &mockBackend{
|
||||||
evmResult: nil,
|
evmResult: nil,
|
||||||
evmError:
|
evmError: nil,
|
||||||
|
}
|
||||||
|
|
||||||
|
api := NewPublicEthereumAPI(backend)
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
// Викликаємо DoCall
|
||||||
|
result, err := api.DoCall(ctx, CallArgs{}, rpc.BlockNumberOrHash{})
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
t.Error("expected error when ApplyMessage returns nil, got nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
if result != (hexutil.Bytes{}) {
|
||||||
|
t.Errorf("expected empty result, got %v", result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue