vm: implement ASSERT/ABORT opcodes

Rename THROWIFNOT to ASSERT, add ABORT opcode.
ABORT cannot be caught, but the implementation should be postponed until
exception handling is implemented.
This commit is contained in:
Evgenii Stratonikov 2020-05-06 15:54:18 +03:00
parent 963a70d54a
commit 977c431bf1
9 changed files with 104 additions and 98 deletions

View file

@ -9,10 +9,10 @@ import (
// Nothing more to test here, really.
func TestStringer(t *testing.T) {
tests := map[Opcode]string{
ADD: "ADD",
SUB: "SUB",
THROWIFNOT: "THROWIFNOT",
0xff: "Opcode(255)",
ADD: "ADD",
SUB: "SUB",
ASSERT: "ASSERT",
0xff: "Opcode(255)",
}
for o, s := range tests {
assert.Equal(t, s, o.String())