mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
test: print better error messages on compilation failure
This commit is contained in:
committed by
Ron Evans
parent
8e7ea92d44
commit
d1efffe96b
+9
-1
@@ -13,6 +13,8 @@ import (
|
||||
"runtime"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/tinygo-org/tinygo/loader"
|
||||
)
|
||||
|
||||
const TESTDATA = "testdata"
|
||||
@@ -121,7 +123,13 @@ func runTest(path, tmpdir string, target string, t *testing.T) {
|
||||
binary := filepath.Join(tmpdir, "test")
|
||||
err = Build("./"+path, binary, target, config)
|
||||
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()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user