diff --git a/gnovm/cmd/gno/test.go b/gnovm/cmd/gno/test.go index f0b9408a856..abf2b3637dc 100644 --- a/gnovm/cmd/gno/test.go +++ b/gnovm/cmd/gno/test.go @@ -432,6 +432,9 @@ func runTestFiles( ) (errs error) { defer func() { if r := recover(); r != nil { + if st := m.ExceptionsStacktrace(); st != "" { + errs = multierr.Append(errors.New(st), errs) + } errs = multierr.Append(fmt.Errorf("panic: %v\nstack:\n%v\ngno machine: %v", r, string(debug.Stack()), m.String()), errs) } }() diff --git a/gnovm/pkg/test/filetest.go b/gnovm/pkg/test/filetest.go index deb15adab8b..e24a13c144f 100644 --- a/gnovm/pkg/test/filetest.go +++ b/gnovm/pkg/test/filetest.go @@ -378,10 +378,16 @@ func (d Directives) FileTest() string { default: bld.WriteString("// " + dir.Name + ":\n") cnt := strings.TrimSuffix(dir.Content, "\n") - cnt = strings.ReplaceAll(cnt, "\n", "\n// ") - bld.WriteString("// ") - bld.WriteString(cnt) - bld.WriteByte('\n') + lines := strings.Split(cnt, "\n") + for _, line := range lines { + if line == "" { + bld.WriteString("//\n") + continue + } + bld.WriteString("// ") + bld.WriteString(line) + bld.WriteByte('\n') + } } } return bld.String()