Dirty initial commit

This commit is contained in:
He4eT 2021-02-23 12:31:02 +05:00
commit eab87d32a9
13 changed files with 7039 additions and 0 deletions

82
tests/player.stdio.js Normal file
View file

@ -0,0 +1,82 @@
#!/usr/bin/env node
/*
Emglken runner
==============
Copyright (c) 2020 Dannii Willis
MIT licenced
https://github.com/curiousdannii/emglken
*/
const fs = require('fs')
const minimist = require('minimist')
const CheapGlkOte = require('../src/')
const { handlers } = require('../src/stdio')
const formats = [
{
id: 'bocfel',
extensions: /z([3458]|blorb)$/,
engine: 'bocfel.js',
},
{
id: 'glulxe',
extensions: /(gblorb|ulx)$/,
engine: 'glulxe.js',
},
{
id: 'git',
extensions: /(gblorb|ulx)$/,
engine: 'git.js',
},
{
id: 'hugo',
extensions: /hex$/,
engine: 'hugo.js',
},
{
id: 'tads',
extensions: /(gam|t3)$/,
engine: 'tads.js',
},
]
function run() {
const argv = minimist(process.argv.slice(2))
const storyfile = argv._[0]
let format
for (const formatspec of formats) {
if (
formatspec.id === argv.vm ||
(!argv.vm && formatspec.extensions.test(storyfile))
) {
format = formatspec
break
}
}
if (!format) {
console.error('Unknown storyfile format')
return
}
const { glkInterface, sendFn } = CheapGlkOte(handlers)
handlers.setSend(sendFn)
const engine = require('emglken/src/' + format.engine)
const vm = new engine()
vm.prepare(fs.readFileSync(storyfile), glkInterface)
vm.start()
}
run()

BIN
tests/praxix.z5 Normal file

Binary file not shown.

5
tests/runtests.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
cd "$(dirname "$0")"
node player.stdio.js praxix.z5 < <(sleep 1 && echo 'all')