--- /dev/null
+#!/usr/bin/env node
+
+const fs = require('fs');
+const buf = fs.readFileSync(process.argv[2]);
+
+let wasm_memory;
+
+const ENV = {
+ host: {
+ print_str(ptr, len) {
+ const data = new Uint8Array(wasm_memory, ptr, len);
+ const str = new TextDecoder().decode(data);
+ process.stdout.write(str);
+ }
+ }
+}
+
+WebAssembly.instantiate(new Uint8Array(buf), ENV)
+ .then(res => {
+ const lib = res.instance.exports;
+ wasm_memory = lib.memory.buffer;
+
+ lib._start();
+ });
+
continue
fi
- if ! node onyxcmd.js "./tests/$name.wasm" > ./tmpoutput; then
+ if ! ./bin/onyx-js "./tests/$name.wasm" > ./tmpoutput; then
echo "❌ Failed to run $name.onyx."
failed=1
continue
+++ /dev/null
-const fs = require('fs');
-const buf = fs.readFileSync(process.argv[2]);
-
-let wasm_memory;
-
-const ENV = {
- host: {
- print_str(ptr, len) {
- const data = new Uint8Array(wasm_memory, ptr, len);
- const str = new TextDecoder().decode(data);
- process.stdout.write(str);
- }
- }
-}
-
-WebAssembly.instantiate(new Uint8Array(buf), ENV)
- .then(res => {
- const lib = res.instance.exports;
- wasm_memory = lib.memory.buffer;
-
- lib._start();
- });
-