diff options
author | Ayke van Laethem <[email protected]> | 2024-07-12 18:28:53 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-07-20 14:30:34 +0200 |
commit | 80269b98ba1163485edf0972d1b9e93353f67e5b (patch) | |
tree | 31130a2b2e6215655772272c7461a254248eaee7 /main_test.go | |
parent | 3788b31ba52a79a1a0f832c0096e7805df6b8ee1 (diff) | |
download | tinygo-80269b98ba1163485edf0972d1b9e93353f67e5b.tar.gz tinygo-80269b98ba1163485edf0972d1b9e93353f67e5b.zip |
diagnostics: move diagnostic printing to a new package
This is a refactor, which should (in theory) not change the behavior of
the compiler. But since this is a pretty large change, there is a chance
there will be some regressions. For that reason, the previous commits
added a bunch of tests to make sure most error messages will not be
changed due to this refactor.
Diffstat (limited to 'main_test.go')
-rw-r--r-- | main_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/main_test.go b/main_test.go index d54af8634..c294b3a8a 100644 --- a/main_test.go +++ b/main_test.go @@ -24,6 +24,7 @@ import ( "github.com/aykevl/go-wasm" "github.com/tinygo-org/tinygo/builder" "github.com/tinygo-org/tinygo/compileopts" + "github.com/tinygo-org/tinygo/diagnostics" "github.com/tinygo-org/tinygo/goenv" ) @@ -380,7 +381,11 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c return cmd.Run() }) if err != nil { - printCompilerError(err, t.Log, "") + w := &bytes.Buffer{} + diagnostics.CreateDiagnostics(err).WriteTo(w, "") + for _, line := range strings.Split(strings.TrimRight(w.String(), "\n"), "\n") { + t.Log(line) + } t.Fail() return } |