test: print better error messages on compilation failure
Этот коммит содержится в:
родитель
8e7ea92d44
коммит
d1efffe96b
1 изменённых файлов: 9 добавлений и 1 удалений
10
main_test.go
10
main_test.go
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче