mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 23:07:42 +03:00
2020-03-16 release
This commit is contained in:
@@ -917,11 +917,9 @@ function load_result(filename)
|
||||
var f, str, res;
|
||||
if (typeof std === "undefined")
|
||||
return null;
|
||||
try {
|
||||
f = std.open(filename, "r");
|
||||
} catch(e) {
|
||||
f = std.open(filename, "r");
|
||||
if (!f)
|
||||
return null;
|
||||
}
|
||||
str = f.readAsString();
|
||||
res = JSON.parse(str);
|
||||
f.close();
|
||||
|
@@ -501,6 +501,10 @@ function test_regexp()
|
||||
a = eval("/\0a/");
|
||||
assert(a.toString(), "/\0a/");
|
||||
assert(a.exec("\0a")[0], "\0a");
|
||||
|
||||
assert(/{1a}/.toString(), "/{1a}/");
|
||||
a = /a{1+/.exec("a{11");
|
||||
assert(a, ["a{11"] );
|
||||
}
|
||||
|
||||
function test_symbol()
|
||||
|
@@ -106,6 +106,9 @@ function test_popen()
|
||||
f.puts(content);
|
||||
f.close();
|
||||
|
||||
/* test loadFile */
|
||||
assert(std.loadFile(fname), content);
|
||||
|
||||
/* execute the 'cat' shell command */
|
||||
f = std.popen("cat " + fname, "r");
|
||||
str = f.readAsString();
|
||||
@@ -142,13 +145,19 @@ function test_os()
|
||||
buf[i] = i;
|
||||
assert(os.write(fd, buf.buffer, 0, buf.length) === buf.length);
|
||||
|
||||
assert(os.seek(fd, 0, os.SEEK_SET) === 0);
|
||||
assert(os.seek(fd, 0, std.SEEK_SET) === 0);
|
||||
buf2 = new Uint8Array(buf.length);
|
||||
assert(os.read(fd, buf2.buffer, 0, buf2.length) === buf2.length);
|
||||
|
||||
for(i = 0; i < buf.length; i++)
|
||||
assert(buf[i] == buf2[i]);
|
||||
|
||||
if (typeof BigInt !== "undefined") {
|
||||
assert(os.seek(fd, BigInt(6), std.SEEK_SET), BigInt(6));
|
||||
assert(os.read(fd, buf2.buffer, 0, 1) === 1);
|
||||
assert(buf[6] == buf2[0]);
|
||||
}
|
||||
|
||||
assert(os.close(fd) === 0);
|
||||
|
||||
[files, err] = os.readdir(fdir);
|
||||
|
Reference in New Issue
Block a user