aboutsummaryrefslogtreecommitdiffhomepage
path: root/main_test.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-03-03 17:55:57 +0100
committerRon Evans <[email protected]>2020-03-16 07:40:23 -0700
commit982b2d06ab640804c220068b8eeb845d198cc701 (patch)
tree0e55cea65fb7cb833992f97a4d94c18d33e27514 /main_test.go
parentad8996c4ee028bfead4b165149cb748febec498a (diff)
downloadtinygo-982b2d06ab640804c220068b8eeb845d198cc701.tar.gz
tinygo-982b2d06ab640804c220068b8eeb845d198cc701.zip
main: improve error reporting while running go test
This commit switches integration tests to use the same error reporting mechanism as the tinygo compiler normally uses. It replaces errors like this: main_test.go:139: failed to build: interp: branch on a non-constant With this: main.go:693: # math/rand main.go:695: interp: branch on a non-constant In this particular case the error isn't much better (it gives the relevant package, though) but other errors should also include the source location where they happen.
Diffstat (limited to 'main_test.go')
-rw-r--r--main_test.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/main_test.go b/main_test.go
index dbdca1f87..9140bae49 100644
--- a/main_test.go
+++ b/main_test.go
@@ -17,7 +17,6 @@ import (
"time"
"github.com/tinygo-org/tinygo/compileopts"
- "github.com/tinygo-org/tinygo/loader"
)
const TESTDATA = "testdata"
@@ -131,13 +130,7 @@ func runTest(path, target string, t *testing.T) {
binary := filepath.Join(tmpdir, "test")
err = runBuild("./"+path, binary, config)
if err != nil {
- 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)
- }
+ printCompilerError(t.Log, err)
t.Fail()
return
}