mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 16:52:28 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
6
third_party/quickjs/tests/bjson.c
vendored
6
third_party/quickjs/tests/bjson.c
vendored
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* QuickJS: binary JSON module (test only)
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2017-2019 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -32,7 +32,7 @@ static JSValue js_bjson_read(JSContext *ctx, JSValueConst this_val,
|
|||
JSValue obj;
|
||||
size_t size;
|
||||
int flags;
|
||||
|
||||
|
||||
if (JS_ToIndex(ctx, &pos, argv[1]))
|
||||
return JS_EXCEPTION;
|
||||
if (JS_ToIndex(ctx, &len, argv[2]))
|
||||
|
@ -56,7 +56,7 @@ static JSValue js_bjson_write(JSContext *ctx, JSValueConst this_val,
|
|||
uint8_t *buf;
|
||||
JSValue array;
|
||||
int flags;
|
||||
|
||||
|
||||
flags = 0;
|
||||
if (JS_ToBool(ctx, argv[1]))
|
||||
flags |= JS_WRITE_OBJ_REFERENCE;
|
||||
|
|
8
third_party/quickjs/tests/microbench.js
vendored
8
third_party/quickjs/tests/microbench.js
vendored
|
@ -60,7 +60,7 @@ function toPrec(n, prec) {
|
|||
s = s.substring(0, i) + "." + s.substring(i);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
var ref_data;
|
||||
var log_data;
|
||||
|
||||
|
@ -995,7 +995,7 @@ function main(argc, argv, g)
|
|||
];
|
||||
var tests = [];
|
||||
var i, j, n, f, name;
|
||||
|
||||
|
||||
if (typeof BigInt == "function") {
|
||||
/* BigInt test */
|
||||
test_list.push(bigint64_arith);
|
||||
|
@ -1005,7 +1005,7 @@ function main(argc, argv, g)
|
|||
/* BigFloat test */
|
||||
test_list.push(float256_arith);
|
||||
}
|
||||
|
||||
|
||||
for (i = 1; i < argc;) {
|
||||
name = argv[i++];
|
||||
if (name == "-a") {
|
||||
|
@ -1055,7 +1055,7 @@ function main(argc, argv, g)
|
|||
log_line("total", "", total[2], total[3], total_score * 100 / total_scale);
|
||||
else
|
||||
log_line("total", "", total[2]);
|
||||
|
||||
|
||||
if (tests == test_list)
|
||||
save_result("microbench-new.txt", log_data);
|
||||
}
|
||||
|
|
6
third_party/quickjs/tests/test262.patch
vendored
6
third_party/quickjs/tests/test262.patch
vendored
|
@ -19,7 +19,7 @@ index 9c1217351e..3c24755558 100644
|
|||
+ long: 100,
|
||||
+ huge: 1000,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
diff --git a/harness/regExpUtils.js b/harness/regExpUtils.js
|
||||
index be7039fda0..7b38abf8df 100644
|
||||
|
@ -28,7 +28,7 @@ index be7039fda0..7b38abf8df 100644
|
|||
@@ -6,24 +6,27 @@ description: |
|
||||
defines: [buildString, testPropertyEscapes, matchValidator]
|
||||
---*/
|
||||
|
||||
|
||||
+if ($262 && typeof $262.codePointRange === "function") {
|
||||
+ /* use C function to build the codePointRange (much faster with
|
||||
+ slow JS engines) */
|
||||
|
@ -67,5 +67,5 @@ index be7039fda0..7b38abf8df 100644
|
|||
- return result;
|
||||
+ return result;
|
||||
}
|
||||
|
||||
|
||||
function testPropertyEscapes(regex, string, expression) {
|
||||
|
|
20
third_party/quickjs/tests/test_bignum.js
vendored
20
third_party/quickjs/tests/test_bignum.js
vendored
|
@ -94,7 +94,7 @@ function test_bigint1()
|
|||
|
||||
r = 1n << 31n;
|
||||
assert(r, 2147483648n, "1 << 31n === 2147483648n");
|
||||
|
||||
|
||||
r = 1n << 32n;
|
||||
assert(r, 4294967296n, "1 << 32n === 4294967296n");
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ function test_bigint_ext()
|
|||
function test_bigfloat()
|
||||
{
|
||||
var e, a, b, sqrt2;
|
||||
|
||||
|
||||
assert(typeof 1n === "bigint");
|
||||
assert(typeof 1l === "bigfloat");
|
||||
assert(1 == 1.0l);
|
||||
|
@ -164,7 +164,7 @@ function test_bigfloat()
|
|||
|
||||
test_less(2.1, 3l);
|
||||
test_eq(Math.sqrt(9), 3l);
|
||||
|
||||
|
||||
test_less(2n, 3l);
|
||||
test_eq(3n, 3l);
|
||||
|
||||
|
@ -174,7 +174,7 @@ function test_bigfloat()
|
|||
assert(a === BigFloat.parseFloat("0x1.6a09e667f3bcc908b2fb1366ea957d3e", 0, e));
|
||||
assert(e.inexact === true);
|
||||
assert(BigFloat.fpRound(a) == 0x1.6a09e667f3bcc908b2fb1366ea95l);
|
||||
|
||||
|
||||
b = BigFloatEnv.setPrec(BigFloat.sqrt.bind(null, 2), 128);
|
||||
assert(a === b);
|
||||
|
||||
|
@ -188,7 +188,7 @@ function test_bigfloat()
|
|||
assert(BigFloat.exp(0.2l) === 1.2214027581601698339210719946396742l);
|
||||
assert(BigFloat.log(3l) === 1.0986122886681096913952452369225256l);
|
||||
assert(BigFloat.pow(2.1l, 1.6l) === 3.277561666451861947162828744873745l);
|
||||
|
||||
|
||||
assert(BigFloat.sin(-1l) === -0.841470984807896506652502321630299l);
|
||||
assert(BigFloat.cos(1l) === 0.5403023058681397174009366074429766l);
|
||||
assert(BigFloat.tan(0.1l) === 0.10033467208545054505808004578111154l);
|
||||
|
@ -241,16 +241,16 @@ function test_bigdecimal()
|
|||
assert(1m !== 2m);
|
||||
test_less(1m, 2m);
|
||||
test_eq(2m, 2m);
|
||||
|
||||
|
||||
test_less(1, 2m);
|
||||
test_eq(2, 2m);
|
||||
|
||||
test_less(1.1, 2m);
|
||||
test_eq(Math.sqrt(4), 2m);
|
||||
|
||||
|
||||
test_less(2n, 3m);
|
||||
test_eq(3n, 3m);
|
||||
|
||||
|
||||
assert(BigDecimal("1234.1") === 1234.1m);
|
||||
assert(BigDecimal(" 1234.1") === 1234.1m);
|
||||
assert(BigDecimal(" 1234.1 ") === 1234.1m);
|
||||
|
@ -272,7 +272,7 @@ function test_bigdecimal()
|
|||
assert(1234.5m ** 3m === 1881365963.625m);
|
||||
assertThrows(RangeError, () => { 2m ** 3.1m } );
|
||||
assertThrows(RangeError, () => { 2m ** -3m } );
|
||||
|
||||
|
||||
assert(BigDecimal.sqrt(2m,
|
||||
{ roundingMode: "half-even",
|
||||
maximumSignificantDigits: 4 }) === 1.414m);
|
||||
|
@ -282,7 +282,7 @@ function test_bigdecimal()
|
|||
assert(BigDecimal.sqrt(0.002m,
|
||||
{ roundingMode: "half-even",
|
||||
maximumFractionDigits: 3 }) === 0.045m);
|
||||
|
||||
|
||||
assert(BigDecimal.round(3.14159m,
|
||||
{ roundingMode: "half-even",
|
||||
maximumFractionDigits: 3 }) === 3.142m);
|
||||
|
|
6
third_party/quickjs/tests/test_bjson.js
vendored
6
third_party/quickjs/tests/test_bjson.js
vendored
|
@ -34,7 +34,7 @@ function toHex(a)
|
|||
|
||||
function isArrayLike(a)
|
||||
{
|
||||
return Array.isArray(a) ||
|
||||
return Array.isArray(a) ||
|
||||
(a instanceof Uint8ClampedArray) ||
|
||||
(a instanceof Uint8Array) ||
|
||||
(a instanceof Uint16Array) ||
|
||||
|
@ -147,7 +147,7 @@ function bjson_test_reference()
|
|||
function bjson_test_all()
|
||||
{
|
||||
var obj;
|
||||
|
||||
|
||||
bjson_test({x:1, y:2, if:3});
|
||||
bjson_test([1, 2, 3]);
|
||||
bjson_test([1.0, "aa", true, false, undefined, null, NaN, -Infinity, -0.0]);
|
||||
|
@ -174,7 +174,7 @@ function bjson_test_all()
|
|||
|
||||
bjson_test(new Int32Array([123123, 222111, -32222]));
|
||||
bjson_test(new Float64Array([123123, 222111.5]));
|
||||
|
||||
|
||||
/* tested with a circular reference */
|
||||
obj = {};
|
||||
obj.x = obj;
|
||||
|
|
24
third_party/quickjs/tests/test_builtin.js
vendored
24
third_party/quickjs/tests/test_builtin.js
vendored
|
@ -57,7 +57,7 @@ function test_function()
|
|||
}
|
||||
|
||||
var r, g;
|
||||
|
||||
|
||||
r = my_func.call(null, 1, 2);
|
||||
assert(r, 3, "call");
|
||||
|
||||
|
@ -70,10 +70,10 @@ function test_function()
|
|||
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");
|
||||
|
||||
|
||||
g = f.bind(1, 2);
|
||||
assert(g.length, 1);
|
||||
assert(g.name, "bound f");
|
||||
|
@ -103,7 +103,7 @@ function test()
|
|||
assert(a.z, 4, "get");
|
||||
a.z = 5;
|
||||
assert(a.z_val, 5, "set");
|
||||
|
||||
|
||||
a = { get z() { return 4; }, set z(val) { this.z_val = val; } };
|
||||
assert(a.z, 4, "get");
|
||||
a.z = 5;
|
||||
|
@ -207,7 +207,7 @@ function test_string()
|
|||
assert(a.charAt(1), "b");
|
||||
assert(a.charAt(-1), "");
|
||||
assert(a.charAt(3), "");
|
||||
|
||||
|
||||
a = "abcd";
|
||||
assert(a.substring(1, 3), "bc", "substring");
|
||||
a = String.fromCharCode(0x20ac);
|
||||
|
@ -216,7 +216,7 @@ function test_string()
|
|||
assert(a, "\u20ac", "unicode");
|
||||
assert(a, "\u{20ac}", "unicode");
|
||||
assert("a", "\x61", "unicode");
|
||||
|
||||
|
||||
a = "\u{10ffff}";
|
||||
assert(a.length, 2, "unicode");
|
||||
assert(a, "\u{dbff}\u{dfff}", "unicode");
|
||||
|
@ -379,7 +379,7 @@ function test_eval()
|
|||
assert(eval("if (0) 2; else 3;"), 3);
|
||||
|
||||
assert(f.call(1, "this"), 1);
|
||||
|
||||
|
||||
a = 2;
|
||||
assert(eval("a"), 2);
|
||||
|
||||
|
@ -424,7 +424,7 @@ function test_typed_array()
|
|||
a[2] = 0.5;
|
||||
a[3] = 1233.5;
|
||||
assert(a.toString(), "0,2,0,255");
|
||||
|
||||
|
||||
buffer = new ArrayBuffer(16);
|
||||
assert(buffer.byteLength, 16);
|
||||
a = new Uint32Array(buffer, 12, 1);
|
||||
|
@ -436,7 +436,7 @@ function test_typed_array()
|
|||
|
||||
a = new Float32Array(buffer, 8, 1);
|
||||
a[0] = 1;
|
||||
|
||||
|
||||
a = new Uint8Array(buffer);
|
||||
|
||||
str = a.toString();
|
||||
|
@ -525,7 +525,7 @@ function test_regexp()
|
|||
|
||||
a = /(\.(?!com|org)|\/)/.exec("ah.com");
|
||||
assert(a, null);
|
||||
|
||||
|
||||
a = /(?=(a+))/.exec("baaabac");
|
||||
assert(a.index === 1 && a[0] === "" && a[1] === "aaa");
|
||||
|
||||
|
@ -592,7 +592,7 @@ function test_map()
|
|||
}
|
||||
|
||||
i = 0;
|
||||
a.forEach(function (v, o) {
|
||||
a.forEach(function (v, o) {
|
||||
assert(o, tab[i++][0]);
|
||||
assert(a.has(o));
|
||||
assert(a.delete(o));
|
||||
|
@ -615,7 +615,7 @@ function test_weak_map()
|
|||
a.set(o, v);
|
||||
}
|
||||
o = null;
|
||||
|
||||
|
||||
n2 = n >> 1;
|
||||
for(i = 0; i < n2; i++) {
|
||||
a.delete(tab[i][0]);
|
||||
|
|
4
third_party/quickjs/tests/test_closure.js
vendored
4
third_party/quickjs/tests/test_closure.js
vendored
|
@ -54,7 +54,7 @@ function test_closure1()
|
|||
function f2()
|
||||
{
|
||||
var val = 1;
|
||||
|
||||
|
||||
function set(a) {
|
||||
val = a;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ function test_closure1()
|
|||
}
|
||||
return { "set": set, "get": get };
|
||||
}
|
||||
|
||||
|
||||
var obj = f2();
|
||||
obj.set(10);
|
||||
var r;
|
||||
|
|
30
third_party/quickjs/tests/test_language.js
vendored
30
third_party/quickjs/tests/test_language.js
vendored
|
@ -68,10 +68,10 @@ function test_op1()
|
|||
|
||||
r = 1 << 31;
|
||||
assert(r, -2147483648, "1 << 31 === -2147483648");
|
||||
|
||||
|
||||
r = 1 << 32;
|
||||
assert(r, 1, "1 << 32 === 1");
|
||||
|
||||
|
||||
r = (1 << 31) < 0;
|
||||
assert(r, true, "(1 << 31) < 0 === true");
|
||||
|
||||
|
@ -113,7 +113,7 @@ function test_cvt()
|
|||
assert(("12345" | 0) === 12345);
|
||||
assert(("0x12345" | 0) === 0x12345);
|
||||
assert(((4294967296 * 3 - 4) | 0) === -4);
|
||||
|
||||
|
||||
assert(("12345" >>> 0) === 12345);
|
||||
assert(("0x12345" >>> 0) === 0x12345);
|
||||
assert((NaN >>> 0) === 0);
|
||||
|
@ -140,7 +140,7 @@ function test_eq()
|
|||
function test_inc_dec()
|
||||
{
|
||||
var a, r;
|
||||
|
||||
|
||||
a = 1;
|
||||
r = a++;
|
||||
assert(r === 1 && a === 2, true, "++");
|
||||
|
@ -168,19 +168,19 @@ function test_inc_dec()
|
|||
a = [true];
|
||||
a[0]++;
|
||||
assert(a[0], 2, "++");
|
||||
|
||||
|
||||
a = {x:true};
|
||||
r = a.x++;
|
||||
assert(r === 1 && a.x === 2, true, "++");
|
||||
|
||||
|
||||
a = {x:true};
|
||||
r = a.x--;
|
||||
assert(r === 1 && a.x === 0, true, "--");
|
||||
|
||||
|
||||
a = [true];
|
||||
r = a[0]++;
|
||||
assert(r === 1 && a[0] === 2, true, "++");
|
||||
|
||||
|
||||
a = [true];
|
||||
r = a[0]--;
|
||||
assert(r === 1 && a[0] === 0, true, "--");
|
||||
|
@ -212,7 +212,7 @@ function test_op2()
|
|||
assert((typeof Object), "function", "typeof");
|
||||
assert((typeof null), "object", "typeof");
|
||||
assert((typeof unknown_var), "undefined", "typeof");
|
||||
|
||||
|
||||
a = {x: 1, if: 2, async: 3};
|
||||
assert(a.if === 2);
|
||||
assert(a.async === 3);
|
||||
|
@ -225,7 +225,7 @@ function test_delete()
|
|||
a = {x: 1, y: 1};
|
||||
assert((delete a.x), true, "delete");
|
||||
assert(("x" in a), false, "delete");
|
||||
|
||||
|
||||
/* the following are not tested by test262 */
|
||||
assert(delete "abc"[100], true);
|
||||
|
||||
|
@ -310,7 +310,7 @@ function test_class()
|
|||
o = new C();
|
||||
assert(o.f() === 1);
|
||||
assert(o.x === 10);
|
||||
|
||||
|
||||
assert(D.F() === -1);
|
||||
assert(D.G() === -2);
|
||||
assert(D.H() === -1);
|
||||
|
@ -364,7 +364,7 @@ function test_regexp_skip()
|
|||
var a, b;
|
||||
[a, b = /abc\(/] = [1];
|
||||
assert(a === 1);
|
||||
|
||||
|
||||
[a, b =/abc\(/] = [2];
|
||||
assert(a === 2);
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ function test_argument_scope()
|
|||
{
|
||||
var f;
|
||||
var c = "global";
|
||||
|
||||
|
||||
f = function(a = eval("var arguments")) {};
|
||||
assert_throws(SyntaxError, f);
|
||||
|
||||
|
@ -480,7 +480,7 @@ function test_function_expr_name()
|
|||
|
||||
/* non strict mode test : assignment to the function name silently
|
||||
fails */
|
||||
|
||||
|
||||
f = function myfunc() {
|
||||
myfunc = 1;
|
||||
return myfunc;
|
||||
|
@ -501,7 +501,7 @@ function test_function_expr_name()
|
|||
return myfunc;
|
||||
};
|
||||
assert(f(), f);
|
||||
|
||||
|
||||
/* strict mode test : assignment to the function name raises a
|
||||
TypeError exception */
|
||||
|
||||
|
|
2
third_party/quickjs/tests/test_loop.js
vendored
2
third_party/quickjs/tests/test_loop.js
vendored
|
@ -333,7 +333,7 @@ function test_try_catch7()
|
|||
function test_try_catch8()
|
||||
{
|
||||
var i, s;
|
||||
|
||||
|
||||
s = "";
|
||||
for(var i in {x:1, y:2}) {
|
||||
try {
|
||||
|
|
|
@ -35,7 +35,7 @@ function test_operators_create() {
|
|||
return "Vec2(" + this.x + "," + this.y + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vec2.prototype[Symbol.operatorSet] = Operators.create(
|
||||
{
|
||||
"+"(p1, p2) {
|
||||
|
@ -172,7 +172,7 @@ function test_operators()
|
|||
return "Vec2(" + this.x + "," + this.y + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var a = new Vec2(1, 2);
|
||||
var b = new Vec2(3, 4);
|
||||
var r;
|
||||
|
|
8
third_party/quickjs/tests/test_qjscalc.js
vendored
8
third_party/quickjs/tests/test_qjscalc.js
vendored
|
@ -60,10 +60,10 @@ function test_integer()
|
|||
|
||||
r = 1 << 31;
|
||||
assert(r, 2147483648, "1 << 31 === 2147483648");
|
||||
|
||||
|
||||
r = 1 << 32;
|
||||
assert(r, 4294967296, "1 << 32 === 4294967296");
|
||||
|
||||
|
||||
r = (1 << 31) < 0;
|
||||
assert(r, false, "(1 << 31) < 0 === false");
|
||||
|
||||
|
@ -115,7 +115,7 @@ function test_fraction()
|
|||
function test_mod()
|
||||
{
|
||||
var a, b, p;
|
||||
|
||||
|
||||
a = Mod(3, 101);
|
||||
b = Mod(-1, 101);
|
||||
assert((a + b) == Mod(2, 101));
|
||||
|
@ -131,7 +131,7 @@ function test_polynomial()
|
|||
var a, b, q, r, t, i;
|
||||
a = (1 + X) ^ 4;
|
||||
assert(a == X^4+4*X^3+6*X^2+4*X+1);
|
||||
|
||||
|
||||
r = (1 + X);
|
||||
q = (1+X+X^2);
|
||||
b = (1 - X^2);
|
||||
|
|
30
third_party/quickjs/tests/test_std.js
vendored
30
third_party/quickjs/tests/test_std.js
vendored
|
@ -45,7 +45,7 @@ function test_file1()
|
|||
f.seek(0, std.SEEK_SET);
|
||||
str1 = f.readAsString();
|
||||
assert(str1 === str);
|
||||
|
||||
|
||||
f.seek(0, std.SEEK_END);
|
||||
size = f.tell();
|
||||
assert(size === str.length);
|
||||
|
@ -80,7 +80,7 @@ function test_file2()
|
|||
function test_getline()
|
||||
{
|
||||
var f, line, line_count, lines, i;
|
||||
|
||||
|
||||
lines = ["hello world", "line 1", "line 2" ];
|
||||
f = std.tmpfile();
|
||||
for(i = 0; i < lines.length; i++) {
|
||||
|
@ -102,7 +102,7 @@ function test_getline()
|
|||
|
||||
f.close();
|
||||
}
|
||||
|
||||
|
||||
function test_popen()
|
||||
{
|
||||
var str, f, fname = "tmp_file.txt";
|
||||
|
@ -114,7 +114,7 @@ function test_popen()
|
|||
|
||||
/* test loadFile */
|
||||
assert(std.loadFile(fname), content);
|
||||
|
||||
|
||||
/* execute the 'cat' shell command */
|
||||
f = std.popen("cat " + fname, "r");
|
||||
str = f.readAsString();
|
||||
|
@ -149,17 +149,17 @@ function test_os()
|
|||
fname = "tmp_file.txt";
|
||||
fpath = fdir + "/" + fname;
|
||||
link_path = fdir + "/test_link";
|
||||
|
||||
|
||||
os.remove(link_path);
|
||||
os.remove(fpath);
|
||||
os.remove(fdir);
|
||||
|
||||
err = os.mkdir(fdir, 0o755);
|
||||
assert(err === 0);
|
||||
|
||||
|
||||
fd = os.open(fpath, os.O_RDWR | os.O_CREAT | os.O_TRUNC);
|
||||
assert(fd >= 0);
|
||||
|
||||
|
||||
buf = new Uint8Array(10);
|
||||
for(i = 0; i < buf.length; i++)
|
||||
buf[i] = i;
|
||||
|
@ -168,16 +168,16 @@ function test_os()
|
|||
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);
|
||||
|
@ -188,7 +188,7 @@ function test_os()
|
|||
|
||||
err = os.utimes(fpath, fdate, fdate);
|
||||
assert(err, 0);
|
||||
|
||||
|
||||
[st, err] = os.stat(fpath);
|
||||
assert(err, 0);
|
||||
assert(st.mode & os.S_IFMT, os.S_IFREG);
|
||||
|
@ -196,7 +196,7 @@ function test_os()
|
|||
|
||||
err = os.symlink(fname, link_path);
|
||||
assert(err === 0);
|
||||
|
||||
|
||||
[st, err] = os.lstat(link_path);
|
||||
assert(err, 0);
|
||||
assert(st.mode & os.S_IFMT, os.S_IFLNK);
|
||||
|
@ -204,7 +204,7 @@ function test_os()
|
|||
[buf, err] = os.readlink(link_path);
|
||||
assert(err, 0);
|
||||
assert(buf, fname);
|
||||
|
||||
|
||||
assert(os.remove(link_path) === 0);
|
||||
|
||||
[buf, err] = os.getcwd();
|
||||
|
@ -214,7 +214,7 @@ function test_os()
|
|||
assert(err, 0);
|
||||
|
||||
assert(buf, buf2);
|
||||
|
||||
|
||||
assert(os.remove(fpath) === 0);
|
||||
|
||||
fd = os.open(fpath, os.O_RDONLY);
|
||||
|
@ -232,7 +232,7 @@ function test_os_exec()
|
|||
|
||||
ret = os.exec(["/bin/sh", "-c", "exit 1"], { usePath: false });
|
||||
assert(ret, 1);
|
||||
|
||||
|
||||
fds = os.pipe();
|
||||
pid = os.exec(["sh", "-c", "echo $FOO"], {
|
||||
stdout: fds[1],
|
||||
|
|
|
@ -21,10 +21,10 @@ function handle_msg(e) {
|
|||
|
||||
function worker_main() {
|
||||
var i;
|
||||
|
||||
|
||||
parent.onmessage = handle_msg;
|
||||
for(i = 0; i < 10; i++) {
|
||||
parent.postMessage({ type: "num", num: i });
|
||||
parent.postMessage({ type: "num", num: i });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue