From e4ee7cd40727bc1ba8488508d498c7f43e6d8f00 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Dec 2020 12:38:22 +0300 Subject: [PATCH] vm: improve coverage for default interops --- pkg/vm/vm_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/vm/vm_test.go b/pkg/vm/vm_test.go index 56d8598e9..a813304bf 100644 --- a/pkg/vm/vm_test.go +++ b/pkg/vm/vm_test.go @@ -528,11 +528,21 @@ func testIterableCreate(t *testing.T, typ string, isByteArray bool) { func TestEnumeratorCreate(t *testing.T) { t.Run("Array", func(t *testing.T) { testIterableCreate(t, "Enumerator", false) }) t.Run("ByteArray", func(t *testing.T) { testIterableCreate(t, "Enumerator", true) }) + t.Run("Interop", func(t *testing.T) { + v := New() + v.Estack().PushVal(stackitem.NewInterop([]byte{42})) + require.Error(t, EnumeratorCreate(v)) + }) } func TestIteratorCreate(t *testing.T) { t.Run("Array", func(t *testing.T) { testIterableCreate(t, "Iterator", false) }) t.Run("ByteArray", func(t *testing.T) { testIterableCreate(t, "Iterator", true) }) + t.Run("Interop", func(t *testing.T) { + v := New() + v.Estack().PushVal(stackitem.NewInterop([]byte{42})) + require.Error(t, IteratorCreate(v)) + }) } func testIterableConcat(t *testing.T, typ string) {