vm: improve error message for (*executor).checkError
It is helpful if something goes wrong.
This commit is contained in:
parent
7c48177bf7
commit
6cdb701a9d
1 changed files with 2 additions and 1 deletions
|
@ -104,7 +104,8 @@ func (e *executor) checkNextLine(t *testing.T, expected string) {
|
||||||
func (e *executor) checkError(t *testing.T, expectedErr error) {
|
func (e *executor) checkError(t *testing.T, expectedErr error) {
|
||||||
line, err := e.out.ReadString('\n')
|
line, err := e.out.ReadString('\n')
|
||||||
require.NoError(t, err)
|
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{}) {
|
func (e *executor) checkStack(t *testing.T, items ...interface{}) {
|
||||||
|
|
Loading…
Reference in a new issue