0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-01 20:25:12 -05:00
denoland-deno/deno2/js/mock_runtime.js

19 lines
405 B
JavaScript
Raw Normal View History

2018-06-11 17:01:35 +02:00
// A simple runtime that doesn't involve typescript or protobufs to test
// libdeno.
const window = eval("this");
2018-06-11 17:01:35 +02:00
window['foo'] = () => {
deno_print("Hello world from foo");
return "foo";
}
2018-06-11 18:17:28 +02:00
function assert(cond) {
if (!cond) throw Error("mock_runtime.js assert failed");
2018-06-11 18:17:28 +02:00
}
2018-06-11 19:18:53 +02:00
function subabc() {
deno_sub((msg) => {
2018-06-11 18:17:28 +02:00
assert(msg instanceof ArrayBuffer);
assert(msg.byteLength === 3);
});
}