2018-06-11 17:01:35 +02:00
|
|
|
// A simple runtime that doesn't involve typescript or protobufs to test
|
|
|
|
// libdeno.
|
2018-06-11 19:05:27 +02:00
|
|
|
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) {
|
2018-06-11 19:05:27 +02:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
}
|