mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 15:03:41 +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"
|
"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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user