From 6cdb701a9d823039947c1478dd7991ec64480673 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 29 Nov 2021 11:09:39 +0300 Subject: [PATCH] vm: improve error message for (*executor).checkError It is helpful if something goes wrong. --- pkg/vm/cli/cli_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/vm/cli/cli_test.go b/pkg/vm/cli/cli_test.go index 3d3761614..654a36a84 100644 --- a/pkg/vm/cli/cli_test.go +++ b/pkg/vm/cli/cli_test.go @@ -104,7 +104,8 @@ func (e *executor) checkNextLine(t *testing.T, expected string) { func (e *executor) checkError(t *testing.T, expectedErr error) { line, err := e.out.ReadString('\n') require.NoError(t, err) - require.True(t, strings.HasPrefix(line, "Error: "+expectedErr.Error())) + expected := "Error: " + expectedErr.Error() + require.True(t, strings.HasPrefix(line, expected), fmt.Errorf("expected `%s`, got `%s`", expected, line)) } func (e *executor) checkStack(t *testing.T, items ...interface{}) {