diff --git a/experiments/maki-interpreter/interpreter.test.js b/experiments/maki-interpreter/interpreter.test.js index f6e48cde..c770c5c4 100644 --- a/experiments/maki-interpreter/interpreter.test.js +++ b/experiments/maki-interpreter/interpreter.test.js @@ -10,23 +10,34 @@ function runFile(relativePath) { interpret({ runtime, buffer, system, log: false }); } -describe("v1.1.1.b3 (Winamp 3.0 full)", () => { - test("can call messageBox with hello World", () => { - const mockMessageBox = jest.fn(); - // The VM depends upon the arity of this function, so we can't use - // `mockMessageBox` directly. - System.prototype.messageBox = function(a, b, c, d) { - mockMessageBox(a, b, c, d); - }; - runFile( - "./reference/maki_compiler/v1.1.1.b3 (Winamp 3.0 full)/hello_world.maki" - ); - expect(mockMessageBox).toHaveBeenCalledTimes(1); - expect(mockMessageBox).toHaveBeenCalledWith( - "Hello World", - "Hello Title", - 1, - null - ); +let mockMessageBox; +beforeEach(() => { + mockMessageBox = jest.fn(); + // The VM depends upon the arity of this function, so we can't use + // `mockMessageBox` directly. + System.prototype.messageBox = function(a, b, c, d) { + mockMessageBox(...arguments); + }; +}); + +describe("can call messageBox with hello World", () => { + const versions = [ + // "v1.1.0.a9 (Winamp 3 alpha 8r)", + "v1.1.1.b3 (Winamp 3.0 build 488d)", + "v1.1.1.b3 (Winamp 3.0 full)" + // "v1.1.13 (Winamp 5.02)", + // "v1.2.0 (Winamp 5.66)" + ]; + versions.forEach(version => { + test(`with bytecode compiled by ${version}`, () => { + runFile(`./reference/maki_compiler/${version}/hello_world.maki`); + expect(mockMessageBox).toHaveBeenCalledTimes(1); + expect(mockMessageBox).toHaveBeenCalledWith( + "Hello World", + "Hello Title", + 1, + null + ); + }); }); }); diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.1.0.a9 (Winamp 3 alpha 8r)/hello_world.m b/experiments/maki-interpreter/reference/maki_compiler/v1.1.0.a9 (Winamp 3 alpha 8r)/hello_world.m new file mode 100755 index 00000000..4075b023 --- /dev/null +++ b/experiments/maki-interpreter/reference/maki_compiler/v1.1.0.a9 (Winamp 3 alpha 8r)/hello_world.m @@ -0,0 +1,7 @@ +#include "lib/std.mi" + +System.onScriptLoaded() +{ + String response; + System.messageBox("Hello World", "Hello Title", 1, response); +} \ No newline at end of file diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.1.0.a9 (Winamp 3 alpha 8r)/hello_world.maki b/experiments/maki-interpreter/reference/maki_compiler/v1.1.0.a9 (Winamp 3 alpha 8r)/hello_world.maki new file mode 100755 index 00000000..db635b67 Binary files /dev/null and b/experiments/maki-interpreter/reference/maki_compiler/v1.1.0.a9 (Winamp 3 alpha 8r)/hello_world.maki differ diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.1.1.b3 (Winamp 3.0 build 488d)/hello_world.m b/experiments/maki-interpreter/reference/maki_compiler/v1.1.1.b3 (Winamp 3.0 build 488d)/hello_world.m new file mode 100755 index 00000000..4075b023 --- /dev/null +++ b/experiments/maki-interpreter/reference/maki_compiler/v1.1.1.b3 (Winamp 3.0 build 488d)/hello_world.m @@ -0,0 +1,7 @@ +#include "lib/std.mi" + +System.onScriptLoaded() +{ + String response; + System.messageBox("Hello World", "Hello Title", 1, response); +} \ No newline at end of file diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.1.1.b3 (Winamp 3.0 build 488d)/hello_world.maki b/experiments/maki-interpreter/reference/maki_compiler/v1.1.1.b3 (Winamp 3.0 build 488d)/hello_world.maki new file mode 100755 index 00000000..dc94fa4d Binary files /dev/null and b/experiments/maki-interpreter/reference/maki_compiler/v1.1.1.b3 (Winamp 3.0 build 488d)/hello_world.maki differ diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.1.13 (Winamp 5.02)/hello_world.m b/experiments/maki-interpreter/reference/maki_compiler/v1.1.13 (Winamp 5.02)/hello_world.m new file mode 100755 index 00000000..4075b023 --- /dev/null +++ b/experiments/maki-interpreter/reference/maki_compiler/v1.1.13 (Winamp 5.02)/hello_world.m @@ -0,0 +1,7 @@ +#include "lib/std.mi" + +System.onScriptLoaded() +{ + String response; + System.messageBox("Hello World", "Hello Title", 1, response); +} \ No newline at end of file diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.1.13 (Winamp 5.02)/hello_world.maki b/experiments/maki-interpreter/reference/maki_compiler/v1.1.13 (Winamp 5.02)/hello_world.maki new file mode 100755 index 00000000..ce0f9cae Binary files /dev/null and b/experiments/maki-interpreter/reference/maki_compiler/v1.1.13 (Winamp 5.02)/hello_world.maki differ diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.2.0 (Winamp 5.66)/hello_world.m b/experiments/maki-interpreter/reference/maki_compiler/v1.2.0 (Winamp 5.66)/hello_world.m new file mode 100755 index 00000000..4075b023 --- /dev/null +++ b/experiments/maki-interpreter/reference/maki_compiler/v1.2.0 (Winamp 5.66)/hello_world.m @@ -0,0 +1,7 @@ +#include "lib/std.mi" + +System.onScriptLoaded() +{ + String response; + System.messageBox("Hello World", "Hello Title", 1, response); +} \ No newline at end of file diff --git a/experiments/maki-interpreter/reference/maki_compiler/v1.2.0 (Winamp 5.66)/hello_world.maki b/experiments/maki-interpreter/reference/maki_compiler/v1.2.0 (Winamp 5.66)/hello_world.maki new file mode 100755 index 00000000..96e8fa53 Binary files /dev/null and b/experiments/maki-interpreter/reference/maki_compiler/v1.2.0 (Winamp 5.66)/hello_world.maki differ