lotus/tvx/builders/predicates.go
Raúl Kripalani 99f466e35e
test vector builder API + partial migration of suites (#229)
Co-authored-by: Anton Evangelatov <anton.evangelatov@gmail.com>
2020-08-14 13:51:43 +01:00

20 lines
440 B
Go

package builders
import (
"fmt"
"github.com/filecoin-project/lotus/chain/vm"
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
)
type ApplyRetPredicate func(ret *vm.ApplyRet) error
func ExitCode(expect exitcode.ExitCode) ApplyRetPredicate {
return func(ret *vm.ApplyRet) error {
if ret.ExitCode == expect {
return nil
}
return fmt.Errorf("message exit code was %d; expected %d", ret.ExitCode, expect)
}
}