diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-06-22 14:57:49 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-06-22 23:42:04 +0200 |
commit | 1330553be1097bc1101c82e03cf8aaab414af9b1 (patch) | |
tree | 5d399a1b0fc9cc6f577b88a4379486ac99a1b39d /src/js/mock_runtime.js | |
parent | 9315adb8c58099f892a8c44e489a62b4e56e376d (diff) |
Add onerror test to mock_runtime_test.cc
Diffstat (limited to 'src/js/mock_runtime.js')
-rw-r--r-- | src/js/mock_runtime.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/js/mock_runtime.js b/src/js/mock_runtime.js index 166df5fc5..bb814e7c8 100644 --- a/src/js/mock_runtime.js +++ b/src/js/mock_runtime.js @@ -75,3 +75,16 @@ global.DoubleSubFails = () => { global.SnapshotBug = () => { assert("1,2,3" === String([1, 2, 3])); }; + +global.ErrorHandling = () => { + global.onerror = (message, source, line, col, error) => { + deno.print(`line ${line} col ${col}`); + assert("ReferenceError: notdefined is not defined" === message); + assert(source === "helloworld.js"); + assert(line === 3); + assert(col === 1); + assert(error instanceof Error); + deno.pub("ErrorHandling", typedArrayToArrayBuffer(new Uint8Array([42]))); + }; + eval("\n\n notdefined()\n//# sourceURL=helloworld.js"); +}; |