[release/1.4.6] console, internal/jsre: colorize JavaScript exceptions too

(cherry picked from commit 14ae5708d6)
This commit is contained in:
Péter Szilágyi
2016-05-11 17:28:29 +03:00
parent c39de61a0a
commit 7c90a2e42e
4 changed files with 37 additions and 12 deletions

View File

@ -281,3 +281,15 @@ func TestPrettyPrint(t *testing.T) {
t.Fatalf("pretty print mismatch: have %s, want %s", output, want)
}
}
// Tests that the JavaScript exceptions are properly formatted and colored.
func TestPrettyError(t *testing.T) {
tester := newTester(t, nil)
defer tester.Close(t)
tester.console.Evaluate("throw 'hello'")
want := jsre.ErrorColor("hello") + "\n"
if output := string(tester.output.Bytes()); output != want {
t.Fatalf("pretty error mismatch: have %s, want %s", output, want)
}
}