From 78050e8b2ca60d3ff011b73669b52de4412b63c9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 29 Dec 2023 10:50:46 +0300 Subject: [PATCH] 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 --- pkg/rpcclient/unwrap/unwrap_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/rpcclient/unwrap/unwrap_test.go b/pkg/rpcclient/unwrap/unwrap_test.go index efec1075a..2014d4db1 100644 --- a/pkg/rpcclient/unwrap/unwrap_test.go +++ b/pkg/rpcclient/unwrap/unwrap_test.go @@ -101,6 +101,12 @@ func TestStdErrors(t *testing.T) { 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) { for _, f := range funcs { _, err := f(&result.Invoke{State: "HALT", Stack: []stackitem.Item{stackitem.Make(42), stackitem.Make(42)}}, nil)