unwrap: Add test for HALT state with an empty stack

Missing piece for perfect coverage. Check that an error is returned an
no panic occurs.

Signed-off-by: Evgenii Stratonikov <fyfyrchik@runbox.com>
This commit is contained in:
Evgenii Stratonikov 2023-12-29 10:50:46 +03:00
parent 4b7b71ce25
commit 78050e8b2c

View file

@ -101,6 +101,12 @@ func TestStdErrors(t *testing.T) {
require.Error(t, err) require.Error(t, err)
} }
}) })
t.Run("HALT state with empty stack", func(t *testing.T) {
for _, f := range funcs {
_, err := f(&result.Invoke{State: "HALT"}, nil)
require.Error(t, err)
}
})
t.Run("multiple return values", func(t *testing.T) { t.Run("multiple return values", func(t *testing.T) {
for _, f := range funcs { for _, f := range funcs {
_, err := f(&result.Invoke{State: "HALT", Stack: []stackitem.Item{stackitem.Make(42), stackitem.Make(42)}}, nil) _, err := f(&result.Invoke{State: "HALT", Stack: []stackitem.Item{stackitem.Make(42), stackitem.Make(42)}}, nil)