--- /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);
+ console.log(str);
+ }
+ }
+}
+
+WebAssembly.instantiate(new Uint8Array(buf), ENV)
+ .then(res => {
+ const lib = res.instance.exports;
+ wasm_memory = lib.memory.buffer;
+
+ lib._start();
+ });
+
--- /dev/null
+#!/bin/sh
+
+success=1
+for test_file in ./tests/*.onyx ; do
+ filename=$(basename -- "$test_file")
+ name="${filename%.*}"
+
+ echo "⏲ Checking $name.onyx"
+
+ if ! ./onyx "$test_file" -o "./tests/$name.wasm" >/dev/null; then
+ echo "❌ Failed to compile $name.onyx."
+ success=0
+ continue
+ fi
+
+ if ! node onyxcmd.js "./tests/$name.wasm" > ./tmpoutput; then
+ echo "❌ Failed to run $name.onyx."
+ success=0
+ continue
+ fi
+
+ if ! diff ./tmpoutput "./tests/$name" >/dev/null; then
+ echo "❌ Test output did not match."
+ success=0
+ continue
+ fi
+done
+rm ./tmpoutput
+
+([ $success = 1 ] && echo "✔ All tests passed.") \
+ || echo "❌ Some tests failed."
--- /dev/null
+Hello, World!
--- /dev/null
+package main
+
+#include_file "core/std/js"
+
+use package core
+
+main :: proc (args: [] cstring) {
+ print("Hello, World!");
+}
\ No newline at end of file