Skip to content

Commit

Permalink
test: more stringent ordering test
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Apr 11, 2022
1 parent 3310af2 commit d79ed0f
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 70 deletions.
Expand Up @@ -430,6 +430,7 @@ export function* transformPrivateKeyDestructuring(
// in RHS. Otherwise we have to pause the iterable and interleave
// the expressions.
// See also https://gist.github.com/nicolo-ribaudo/f8ac7916f89450f2ead77d99855b2098
// and ordering/array-pattern-side-effect-iterable test
const leftElements = left.elements;
const leftElementsAfterIndex = leftElements.splice(index);
const { elements, transformed } = buildAssignmentsFromPatternList(
Expand Down
Expand Up @@ -2,17 +2,25 @@ var log = [];

function push(x, y = x) { log.push(x); return y; }

var log = [];

function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static {
var [{ [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7)
} = push(2, C), [push(8)]: d = push(9) }, ...{ [push(10)]: e = push(11), ...f }] = [C];
var [{ [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14) }, ...{ [push(15)]: e = push(16), ...f }] = [C];
}
}

var nums = Array.from({ length: 12 }, (_, i) => i);
var nums = Array.from({ length: 17 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -3,16 +3,20 @@ var log = [];
function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static {
var [{ [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7)
} = push(2, C), [push(8)]: d = push(9) }, e = push(10)] = [C];
var [{ [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14) }, e = push(15)] = [C];
}
}

var nums = Array.from({ length: 11 }, (_, i) => i);
var nums = Array.from({ length: 16 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -3,19 +3,21 @@ var log = [];
function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static get #z() { push(15) }
static {
var { [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7),
#x: x = push(8),
[push(9)]: d = push(10),
...e
} = push(2, C), [push(11)]: d = push(12), #y: z = push(13), ...f } = C;
var { [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14), #z: z = push(16), ...f } = C;
}
}

var nums = Array.from({ length: 14 }, (_, i) => i);
var nums = Array.from({ length: 17 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -3,16 +3,20 @@ var log = [];
function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static {
var { [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7)
} = push(2, C), [push(8)]: d = push(9) } = C;
var { [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14) } = C;
}
}

var nums = Array.from({ length: 10 }, (_, i) => i);
var nums = Array.from({ length: 15 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -3,6 +3,7 @@
"proposal-destructuring-private",
"proposal-class-static-block",
"proposal-class-properties",
"proposal-private-methods",
["proposal-object-rest-spread", { "useBuiltIns": true }]
]
}
@@ -0,0 +1,29 @@
var log = [];

function push(x, y = x) { log.push(x); return y; }

class C {
static get a() { push(2) }
static get b() { push(7) }
static get c() { push(11) }
static get d() { push(15) }
static get #x() { push(4) };
static get #y() { return push(9, C) };
static {
function *iterator() {
push(0);
yield C;
push(13);
yield C;
}

var [{ [push(1, "a")]: a = push(3), #x: {
[push(6, "b")]: b = push(8),
#y: y = push(-1),
[push(10, "c")]: c = push(12)
} = push(5, C) }, { [push(14, "d")]: d = push(16) }] = iterator();
}
}

var nums = Array.from({ length: 16 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -2,17 +2,25 @@ var log = [];

function push(x, y = x) { log.push(x); return y; }

var log = [];

function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static {
var [{ [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7)
} = push(2, C), [push(8)]: d = push(9) }, ...{ [push(10)]: e = push(11), ...f }] = [C];
var [{ [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14) }, ...{ [push(15)]: e = push(16), ...f }] = [C];
}
}

var nums = Array.from({ length: 12 }, (_, i) => i);
var nums = Array.from({ length: 17 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -3,16 +3,20 @@ var log = [];
function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static {
var [{ [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7)
} = push(2, C), [push(8)]: d = push(9) }, e = push(10)] = [C];
var [{ [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14) }, e = push(15)] = [C];
}
}

var nums = Array.from({ length: 11 }, (_, i) => i);
var nums = Array.from({ length: 16 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -3,19 +3,21 @@ var log = [];
function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static get #z() { push(15) }
static {
var { [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7),
#x: x = push(8),
[push(9)]: d = push(10),
...e
} = push(2, C), [push(11)]: d = push(12), #y: z = push(13), ...f } = C;
var { [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14), #z: z = push(16), ...f } = C;
}
}

var nums = Array.from({ length: 14 }, (_, i) => i);
var nums = Array.from({ length: 17 }, (_, i) => i);
expect(log).toStrictEqual(nums);
Expand Up @@ -3,16 +3,20 @@ var log = [];
function push(x, y = x) { log.push(x); return y; }

class C {
static #x;
static #y;
static get a() { push(1) }
static get b() { push(6) }
static get c() { push(10) }
static get d() { push(13) }
static get #x() { push(3) };
static get #y() { return push(8, C) };
static {
var { [push(0)]: a = push(1), #x: {
[push(3)]: b = push(4),
#y: y = push(5),
[push(6)]: c = push(7)
} = push(2, C), [push(8)]: d = push(9) } = C;
var { [push(0, "a")]: a = push(2), #x: {
[push(5, "b")]: b = push(7),
#y: y = push(-1),
[push(9, "c")]: c = push(11)
} = push(4, C), [push(12, "d")]: d = push(14) } = C;
}
}

var nums = Array.from({ length: 10 }, (_, i) => i);
var nums = Array.from({ length: 15 }, (_, i) => i);
expect(log).toStrictEqual(nums);

0 comments on commit d79ed0f

Please sign in to comment.