mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-23 01:57:29 +00:00
Improve parser tests
Ensure we can parse all scripts and move the parser tests to a parser test file for clarity
This commit is contained in:
parent
6b03a353e7
commit
7bede9cd5a
3 changed files with 37 additions and 8 deletions
|
|
@ -3,14 +3,7 @@ const path = require("path");
|
|||
const System = require("../runtime/System");
|
||||
const runtime = require("../runtime");
|
||||
const interpret = require("./interpreter");
|
||||
|
||||
const VERSIONS = {
|
||||
WINAMP_3_ALPHA: "v1.1.0.a9 (Winamp 3 alpha 8r)",
|
||||
WINAMP_3_BETA: "v1.1.1.b3 (Winamp 3.0 build 488d)",
|
||||
WINAMP_3_FULL: "v1.1.1.b3 (Winamp 3.0 full)",
|
||||
WINAMP_5_02: "v1.1.13 (Winamp 5.02)",
|
||||
WINAMP_5_66: "v1.2.0 (Winamp 5.66)",
|
||||
};
|
||||
const { VERSIONS } = require("./testConstants");
|
||||
|
||||
async function runFile(relativePath) {
|
||||
const system = new System();
|
||||
|
|
|
|||
|
|
@ -2,12 +2,41 @@ const fs = require("fs");
|
|||
const path = require("path");
|
||||
const parse = require("./parser");
|
||||
const { getClass } = require("./objects");
|
||||
const { VERSIONS } = require("./testConstants");
|
||||
|
||||
function parseFile(relativePath) {
|
||||
const buffer = fs.readFileSync(path.join(__dirname, relativePath));
|
||||
return parse(buffer);
|
||||
}
|
||||
|
||||
describe("can parse without crashing", () => {
|
||||
const versions = [
|
||||
// VERSIONS.WINAMP_3_ALPHA,
|
||||
VERSIONS.WINAMP_3_BETA,
|
||||
VERSIONS.WINAMP_3_FULL,
|
||||
VERSIONS.WINAMP_5_02,
|
||||
VERSIONS.WINAMP_5_66,
|
||||
];
|
||||
|
||||
const scripts = [
|
||||
"hello_world.maki",
|
||||
"basicTests.maki",
|
||||
"simpleFunctions.maki",
|
||||
];
|
||||
|
||||
scripts.forEach(script => {
|
||||
describe(`script ${script}`, () => {
|
||||
versions.forEach(version => {
|
||||
test(`compiled with compiler version ${version}`, () => {
|
||||
expect(() => {
|
||||
parseFile(`./reference/maki_compiler/${version}/${script}`);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("standardframe.maki", () => {
|
||||
let maki;
|
||||
beforeEach(() => {
|
||||
7
experiments/modern/src/maki-interpreter/testConstants.js
Normal file
7
experiments/modern/src/maki-interpreter/testConstants.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export const VERSIONS = {
|
||||
WINAMP_3_ALPHA: "v1.1.0.a9 (Winamp 3 alpha 8r)",
|
||||
WINAMP_3_BETA: "v1.1.1.b3 (Winamp 3.0 build 488d)",
|
||||
WINAMP_3_FULL: "v1.1.1.b3 (Winamp 3.0 full)",
|
||||
WINAMP_5_02: "v1.1.13 (Winamp 5.02)",
|
||||
WINAMP_5_66: "v1.2.0 (Winamp 5.66)",
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue