summaryrefslogtreecommitdiff
path: root/libdeno/libdeno_test.js
diff options
context:
space:
mode:
Diffstat (limited to 'libdeno/libdeno_test.js')
-rw-r--r--libdeno/libdeno_test.js48
1 files changed, 4 insertions, 44 deletions
diff --git a/libdeno/libdeno_test.js b/libdeno/libdeno_test.js
index c9eaaa0ca..bb36b02d9 100644
--- a/libdeno/libdeno_test.js
+++ b/libdeno/libdeno_test.js
@@ -99,23 +99,9 @@ global.SnapshotBug = () => {
};
global.GlobalErrorHandling = () => {
- libdeno.setGlobalErrorHandler((message, source, line, col, error) => {
- libdeno.print(`line ${line} col ${col}`, true);
- assert("ReferenceError: notdefined is not defined" === message);
- assert(source === "helloworld.js");
- assert(line === 3);
- assert(col === 1);
- assert(error instanceof Error);
- libdeno.send(new Uint8Array([42]));
- });
eval("\n\n notdefined()\n//# sourceURL=helloworld.js");
};
-global.DoubleGlobalErrorHandlingFails = () => {
- libdeno.setGlobalErrorHandler((message, source, line, col, error) => {});
- libdeno.setGlobalErrorHandler((message, source, line, col, error) => {});
-};
-
// Allocate this buf at the top level to avoid GC.
const dataBuf = new Uint8Array([3, 4]);
@@ -134,33 +120,7 @@ global.DataBuf = () => {
b[1] = 8;
};
-global.PromiseRejectCatchHandling = () => {
- let count = 0;
- let promiseRef = null;
- // When we have an error, libdeno sends something
- function assertOrSend(cond) {
- if (!cond) {
- libdeno.send(new Uint8Array([42]));
- }
- }
- libdeno.setPromiseErrorExaminer(() => {
- assertOrSend(count === 2);
- });
- libdeno.setPromiseRejectHandler((error, event, promise) => {
- count++;
- if (event === "RejectWithNoHandler") {
- assertOrSend(error instanceof Error);
- assertOrSend(error.message === "message");
- assertOrSend(count === 1);
- promiseRef = promise;
- } else if (event === "HandlerAddedAfterReject") {
- assertOrSend(count === 2);
- assertOrSend(promiseRef === promise);
- }
- // Should never reach 3!
- assertOrSend(count !== 3);
- });
-
+global.CheckPromiseErrors = () => {
async function fn() {
throw new Error("message");
}
@@ -169,10 +129,10 @@ global.PromiseRejectCatchHandling = () => {
try {
await fn();
} catch (e) {
- assertOrSend(count === 2);
+ libdeno.send(new Uint8Array([42]));
}
})();
-}
+};
global.Shared = () => {
const ab = libdeno.shared;
@@ -185,4 +145,4 @@ global.Shared = () => {
ui8[0] = 42;
ui8[1] = 43;
ui8[2] = 44;
-}
+};