aboutsummaryrefslogtreecommitdiffstats
path: root/console/console_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-05-11 22:28:29 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-05-30 22:25:23 +0800
commit14ae5708d61059d424c9be9822b85a3f4bb392b3 (patch)
treed5d29a92448808718dac4b6ebd967480656dc7df /console/console_test.go
parentffaf58f0a98bd987bbe76e8669bb22c405dcd62a (diff)
downloaddexon-14ae5708d61059d424c9be9822b85a3f4bb392b3.tar.gz
dexon-14ae5708d61059d424c9be9822b85a3f4bb392b3.tar.zst
dexon-14ae5708d61059d424c9be9822b85a3f4bb392b3.zip
console, internal/jsre: colorize JavaScript exceptions too
Diffstat (limited to 'console/console_test.go')
-rw-r--r--console/console_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/console/console_test.go b/console/console_test.go
index 5d38331e8..72d3a2df6 100644
--- a/console/console_test.go
+++ b/console/console_test.go
@@ -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)
+ }
+}