0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
denoland-deno/deno2/js/mock_runtime.js
Ryan Dahl 9590c87c62 Add deno_dispose to tests.
And fix ArrayBuffer memory problem.
2018-06-11 19:19:30 +02:00

18 lines
407 B
JavaScript

// A simple runtime that doesn't involve typescript or protobufs to test
// libdeno.
const window = eval("this");
window['foo'] = () => {
deno_print("Hello world from foo");
return "foo";
}
function assert(cond) {
if (!cond) throw Error("mock_runtime.js assert failed");
}
function recvabc() {
deno_recv((msg) => {
assert(msg instanceof ArrayBuffer);
assert(msg.byteLength === 3);
});
}