@@ -2,6 +2,7 @@ package js_parser
22
33import (
44 "fmt"
5+ "strings"
56 "testing"
67
78 "github.com/evanw/esbuild/internal/ast"
@@ -18,11 +19,11 @@ func expectParseErrorJSON(t *testing.T, contents string, expected string) {
1819 log := logger .NewDeferLog (logger .DeferLogNoVerboseOrDebug , nil )
1920 ParseJSON (log , test .SourceForTest (contents ), JSONOptions {})
2021 msgs := log .Done ()
21- text := ""
22+ var text strings. Builder
2223 for _ , msg := range msgs {
23- text += msg .String (logger.OutputOptions {}, logger.TerminalInfo {})
24+ text . WriteString ( msg .String (logger.OutputOptions {}, logger.TerminalInfo {}) )
2425 }
25- test .AssertEqualWithDiff (t , text , expected )
26+ test .AssertEqualWithDiff (t , text . String () , expected )
2627 })
2728}
2829
@@ -41,11 +42,11 @@ func expectPrintedJSONWithWarning(t *testing.T, contents string, warning string,
4142 log := logger .NewDeferLog (logger .DeferLogNoVerboseOrDebug , nil )
4243 expr , ok := ParseJSON (log , test .SourceForTest (contents ), JSONOptions {})
4344 msgs := log .Done ()
44- text := ""
45+ var text strings. Builder
4546 for _ , msg := range msgs {
46- text += msg .String (logger.OutputOptions {}, logger.TerminalInfo {})
47+ text . WriteString ( msg .String (logger.OutputOptions {}, logger.TerminalInfo {}) )
4748 }
48- test .AssertEqualWithDiff (t , text , warning )
49+ test .AssertEqualWithDiff (t , text . String () , warning )
4950 if ! ok {
5051 t .Fatal ("Parse error" )
5152 }
0 commit comments