test: print better error messages on compilation failure

Этот коммит содержится в:
Ayke van Laethem 2019-04-20 17:00:52 +02:00 коммит произвёл Ron Evans
родитель 8e7ea92d44
коммит d1efffe96b

Просмотреть файл

@ -13,6 +13,8 @@ import (
"runtime" "runtime"
"sort" "sort"
"testing" "testing"
"github.com/tinygo-org/tinygo/loader"
) )
const TESTDATA = "testdata" const TESTDATA = "testdata"
@ -121,7 +123,13 @@ func runTest(path, tmpdir string, target string, t *testing.T) {
binary := filepath.Join(tmpdir, "test") binary := filepath.Join(tmpdir, "test")
err = Build("./"+path, binary, target, config) err = Build("./"+path, binary, target, config)
if err != nil { if err != nil {
t.Log("failed to build:", err) if errLoader, ok := err.(loader.Errors); ok {
for _, err := range errLoader.Errs {
t.Log("failed to build:", err)
}
} else {
t.Log("failed to build:", err)
}
t.Fail() t.Fail()
return return
} }