api: adds CallWithStack to avoid allocations (#1407)
Signed-off-by: Nuno Cruces <ncruces@users.noreply.github.com>
This commit is contained in:
@@ -488,12 +488,16 @@ func (e *mockModuleEngine) Close(context.Context) {
|
||||
func (ce *mockCallEngine) Definition() api.FunctionDefinition { return nil }
|
||||
|
||||
// Call implements the same method as documented on api.Function.
|
||||
func (ce *mockCallEngine) Call(_ context.Context, _ ...uint64) (results []uint64, err error) {
|
||||
func (ce *mockCallEngine) Call(ctx context.Context, _ ...uint64) (results []uint64, err error) {
|
||||
return nil, ce.CallWithStack(ctx, nil)
|
||||
}
|
||||
|
||||
// CallWithStack implements the same method as documented on api.Function.
|
||||
func (ce *mockCallEngine) CallWithStack(_ context.Context, _ []uint64) error {
|
||||
if ce.callFailIndex >= 0 && ce.index == Index(ce.callFailIndex) {
|
||||
err = errors.New("call failed")
|
||||
return
|
||||
return errors.New("call failed")
|
||||
}
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestStore_getFunctionTypeID(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user