*: make Notify interop accept event name
This commit is contained in:
parent
1154e180fa
commit
3d7fa9de93
17 changed files with 84 additions and 43 deletions
|
@ -30,8 +30,7 @@ func TestNotify(t *testing.T) {
|
|||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
func Main(arg int) {
|
||||
runtime.Notify(arg, "sum", arg+1)
|
||||
runtime.Notify()
|
||||
runtime.Notify("Event1", arg, "sum", arg+1)
|
||||
runtime.Notify("single")
|
||||
}`
|
||||
|
||||
|
@ -39,10 +38,11 @@ func TestNotify(t *testing.T) {
|
|||
v.Estack().PushVal(11)
|
||||
|
||||
require.NoError(t, v.Run())
|
||||
require.Equal(t, 3, len(s.events))
|
||||
require.Equal(t, 2, len(s.events))
|
||||
|
||||
exp0 := []stackitem.Item{stackitem.NewBigInteger(big.NewInt(11)), stackitem.NewByteArray([]byte("sum")), stackitem.NewBigInteger(big.NewInt(12))}
|
||||
assert.Equal(t, exp0, s.events[0].Value())
|
||||
assert.Equal(t, []stackitem.Item{}, s.events[1].Value())
|
||||
assert.Equal(t, []stackitem.Item{stackitem.NewByteArray([]byte("single"))}, s.events[2].Value())
|
||||
assert.Equal(t, "Event1", s.events[0].Name)
|
||||
assert.Equal(t, exp0, s.events[0].Item.Value())
|
||||
assert.Equal(t, "single", s.events[1].Name)
|
||||
assert.Equal(t, []stackitem.Item{}, s.events[1].Item.Value())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue