interop: add Abort() function to ABORT things

Related to #2227.
This commit is contained in:
Roman Khimov 2021-10-22 14:50:51 +03:00
parent e230040c2e
commit 36295357d8
5 changed files with 30 additions and 2 deletions

View file

@ -116,6 +116,18 @@ func TestFromAddress(t *testing.T) {
})
}
func TestAbort(t *testing.T) {
src := `package foo
import "github.com/nspcc-dev/neo-go/pkg/interop/util"
func Main() int {
util.Abort()
return 1
}`
v := vmAndCompile(t, src)
require.Error(t, v.Run())
require.True(t, v.HasFailed())
}
func spawnVM(t *testing.T, ic *interop.Context, src string) *vm.VM {
b, di, err := compiler.CompileWithDebugInfo("foo.go", strings.NewReader(src))
require.NoError(t, err)