2020-09-06 release

This commit is contained in:
bellard
2020-09-06 19:10:15 +02:00
parent 8900766099
commit 7c312df422
26 changed files with 912 additions and 476 deletions

View File

@@ -277,6 +277,8 @@ function test_string()
assert("aaaa".split("aaaaa", 1), [ "aaaa" ]);
assert(eval('"\0"'), "\0");
assert("abc".padStart(Infinity, ""), "abc");
}
function test_math()

View File

@@ -359,6 +359,23 @@ function test_labels()
while (0) x: { break x; };
}
function test_destructuring()
{
function * g () { return 0; };
var [x] = g();
assert(x, void 0);
}
function test_spread()
{
var x;
x = [1, 2, ...[3, 4]];
assert(x.toString(), "1,2,3,4");
x = [ ...[ , ] ];
assert(Object.getOwnPropertyNames(x).toString(), "0,length");
}
test_op1();
test_cvt();
test_eq();
@@ -373,3 +390,5 @@ test_template_skip();
test_object_literal();
test_regexp_skip();
test_labels();
test_destructuring();
test_spread();

View File

@@ -25,38 +25,7 @@ function test_worker()
{
var counter;
/* Note: can use std.loadFile() to read from a file */
worker = new os.Worker(`
import * as std from "std";
import * as os from "os";
var parent = os.Worker.parent;
function handle_msg(e) {
var ev = e.data;
// print("child_recv", JSON.stringify(ev));
switch(ev.type) {
case "abort":
parent.postMessage({ type: "done" });
break;
case "sab":
/* modify the SharedArrayBuffer */
ev.buf[2] = 10;
parent.postMessage({ type: "sab_done", buf: ev.buf });
break;
}
}
function worker_main() {
var i;
parent.onmessage = handle_msg;
for(i = 0; i < 10; i++) {
parent.postMessage({ type: "num", num: i });
}
}
worker_main();
`);
worker = new os.Worker("./test_worker_module.js");
counter = 0;
worker.onmessage = function (e) {

View File

@@ -0,0 +1,31 @@
/* Worker code for test_worker.js */
import * as std from "std";
import * as os from "os";
var parent = os.Worker.parent;
function handle_msg(e) {
var ev = e.data;
// print("child_recv", JSON.stringify(ev));
switch(ev.type) {
case "abort":
parent.postMessage({ type: "done" });
break;
case "sab":
/* modify the SharedArrayBuffer */
ev.buf[2] = 10;
parent.postMessage({ type: "sab_done", buf: ev.buf });
break;
}
}
function worker_main() {
var i;
parent.onmessage = handle_msg;
for(i = 0; i < 10; i++) {
parent.postMessage({ type: "num", num: i });
}
}
worker_main();