2020-11-08 release

This commit is contained in:
bellard
2020-11-08 14:30:56 +01:00
parent 7c312df422
commit b1f67dfc1a
23 changed files with 1880 additions and 4304 deletions

View File

@@ -17,6 +17,22 @@ function assert(actual, expected, message) {
(message ? " (" + message + ")" : ""));
}
function assert_throws(expected_error, func)
{
var err = false;
try {
func();
} catch(e) {
err = true;
if (!(e instanceof expected_error)) {
throw Error("unexpected exception type");
}
}
if (!err) {
throw Error("expected exception");
}
}
// load more elaborate version of assert if available
try { __loadScript("test_assert.js"); } catch(e) {}
@@ -39,7 +55,7 @@ function test_function()
function constructor1(a) {
this.x = a;
}
var r, g;
r = my_func.call(null, 1, 2);
@@ -48,6 +64,13 @@ function test_function()
r = my_func.apply(null, [1, 2]);
assert(r, 3, "apply");
r = (function () { return 1; }).apply(null, undefined);
assert(r, 1);
assert_throws(TypeError, (function() {
Reflect.apply((function () { return 1; }), null, undefined);
}));
r = new Function("a", "b", "return a + b;");
assert(r(2,3), 5, "function");