@@ -164,7 +164,7 @@ func TestWelcome(t *testing.T) {
164
164
165
165
tester .console .Welcome ()
166
166
167
- output := string ( tester .output .Bytes () )
167
+ output := tester .output .String ( )
168
168
if want := "Welcome" ; ! strings .Contains (output , want ) {
169
169
t .Fatalf ("console output missing welcome message: have\n %s\n want also %s" , output , want )
170
170
}
@@ -188,7 +188,7 @@ func TestEvaluate(t *testing.T) {
188
188
defer tester .Close (t )
189
189
190
190
tester .console .Evaluate ("2 + 2" )
191
- if output := string ( tester .output .Bytes () ); ! strings .Contains (output , "4" ) {
191
+ if output := tester .output .String ( ); ! strings .Contains (output , "4" ) {
192
192
t .Fatalf ("statement evaluation failed: have %s, want %s" , output , "4" )
193
193
}
194
194
}
@@ -218,7 +218,7 @@ func TestInteractive(t *testing.T) {
218
218
case <- time .After (time .Second ):
219
219
t .Fatalf ("secondary prompt timeout" )
220
220
}
221
- if output := string ( tester .output .Bytes () ); ! strings .Contains (output , "4" ) {
221
+ if output := tester .output .String ( ); ! strings .Contains (output , "4" ) {
222
222
t .Fatalf ("statement evaluation failed: have %s, want %s" , output , "4" )
223
223
}
224
224
}
@@ -230,7 +230,7 @@ func TestPreload(t *testing.T) {
230
230
defer tester .Close (t )
231
231
232
232
tester .console .Evaluate ("preloaded" )
233
- if output := string ( tester .output .Bytes () ); ! strings .Contains (output , "some-preloaded-string" ) {
233
+ if output := tester .output .String ( ); ! strings .Contains (output , "some-preloaded-string" ) {
234
234
t .Fatalf ("preloaded variable missing: have %s, want %s" , output , "some-preloaded-string" )
235
235
}
236
236
}
@@ -243,7 +243,7 @@ func TestExecute(t *testing.T) {
243
243
tester .console .Execute ("exec.js" )
244
244
245
245
tester .console .Evaluate ("execed" )
246
- if output := string ( tester .output .Bytes () ); ! strings .Contains (output , "some-executed-string" ) {
246
+ if output := tester .output .String ( ); ! strings .Contains (output , "some-executed-string" ) {
247
247
t .Fatalf ("execed variable missing: have %s, want %s" , output , "some-executed-string" )
248
248
}
249
249
}
@@ -275,7 +275,7 @@ func TestPrettyPrint(t *testing.T) {
275
275
string: ` + two + `
276
276
}
277
277
`
278
- if output := string ( tester .output .Bytes () ); output != want {
278
+ if output := tester .output .String ( ); output != want {
279
279
t .Fatalf ("pretty print mismatch: have %s, want %s" , output , want )
280
280
}
281
281
}
@@ -287,7 +287,7 @@ func TestPrettyError(t *testing.T) {
287
287
tester .console .Evaluate ("throw 'hello'" )
288
288
289
289
want := jsre .ErrorColor ("hello" ) + "\n "
290
- if output := string ( tester .output .Bytes () ); output != want {
290
+ if output := tester .output .String ( ); output != want {
291
291
t .Fatalf ("pretty error mismatch: have %s, want %s" , output , want )
292
292
}
293
293
}
0 commit comments