aboutsummaryrefslogtreecommitdiffhomepage
path: root/errors_test.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-07-12 18:28:53 +0200
committerRon Evans <[email protected]>2024-07-20 14:30:34 +0200
commit80269b98ba1163485edf0972d1b9e93353f67e5b (patch)
tree31130a2b2e6215655772272c7461a254248eaee7 /errors_test.go
parent3788b31ba52a79a1a0f832c0096e7805df6b8ee1 (diff)
downloadtinygo-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 'errors_test.go')
-rw-r--r--errors_test.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/errors_test.go b/errors_test.go
index 791741978..71eaff5ef 100644
--- a/errors_test.go
+++ b/errors_test.go
@@ -2,7 +2,6 @@ package main
import (
"bytes"
- "fmt"
"os"
"path/filepath"
"regexp"
@@ -11,6 +10,7 @@ import (
"time"
"github.com/tinygo-org/tinygo/compileopts"
+ "github.com/tinygo-org/tinygo/diagnostics"
)
// Test the error messages of the TinyGo compiler.
@@ -59,9 +59,7 @@ func testErrorMessages(t *testing.T, filename string) {
// Write error message out as plain text.
var buf bytes.Buffer
- printCompilerError(err, func(v ...interface{}) {
- fmt.Fprintln(&buf, v...)
- }, wd)
+ diagnostics.CreateDiagnostics(err).WriteTo(&buf, wd)
actual := strings.TrimRight(buf.String(), "\n")
// Check whether the error is as expected.