Skip to content

Commit 15f73b9

Browse files
pzuraqptomato
authored andcommitted
TEMP: Autogenerated tests without templates
1 parent f02d606 commit 15f73b9

12 files changed

+556
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-context-kind.case
3+
// - src/decorator/default/cls-expr.template
4+
/*---
5+
description: Context kind is the string "field" when decorating a field (decorator usage in a class expression)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
info: |
10+
CreateDecoratorContextObject ( kind, name, initializers, decorationState [ , isStatic ] )
11+
12+
...
13+
14+
6. Else if kind is field, then
15+
a. Let kindStr be "field".
16+
17+
---*/
18+
19+
20+
function dec(_, context) {
21+
assert.sameValue(context.kind, "field");
22+
}
23+
24+
25+
var C = class {
26+
@dec foo;
27+
@dec bar = 123;
28+
29+
@dec static foo;
30+
@dec static bar = 123;
31+
}
32+
33+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-initializers-interleave.case
3+
// - src/decorator/default/cls-expr.template
4+
/*---
5+
description: Decorated field initializers are interleaved with undecorated fields (decorator usage in a class expression)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
---*/
10+
11+
12+
var ord = [];
13+
14+
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) {
15+
ord.push(evalOrd);
16+
17+
return (value, context) => {
18+
ord.push(applyOrd);
19+
20+
context.addInitializer(() => ord.push(extraOrd));
21+
22+
return () => {
23+
ord.push(initOrd);
24+
}
25+
}
26+
}
27+
28+
29+
var C = class {
30+
@pushOrd(0, 5, 9, 12)
31+
@pushOrd(1, 4, 10, 11)
32+
foo = ord.push(8);
33+
34+
bar = ord.push(13);
35+
36+
@pushOrd(2, 7, 15, 18)
37+
@pushOrd(3, 6, 16, 17)
38+
baz = ord.push(14)
39+
40+
}
41+
42+
new C();
43+
44+
assert.sameValue(ord.length, 19);
45+
ord.forEach(assert.sameValue);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-instance-initializer-order.case
3+
// - src/decorator/with-super-class/cls-expr.template
4+
/*---
5+
description: Decorated field instance initializers run after super, before constructor (decorator usage in a class expression)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
---*/
10+
11+
12+
var ord = [];
13+
14+
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) {
15+
ord.push(evalOrd);
16+
17+
return (value, context) => {
18+
ord.push(applyOrd);
19+
20+
context.addInitializer(() => ord.push(extraOrd));
21+
22+
return () => {
23+
ord.push(initOrd);
24+
}
25+
}
26+
}
27+
28+
29+
class B {}
30+
31+
var C = class extends B {
32+
@pushOrd(0, 3, 6, 9)
33+
@pushOrd(1, 2, 7, 8)
34+
foo = ord.push(5);
35+
36+
constructor() {
37+
ord.push(4);
38+
super();
39+
ord.push(10)
40+
}
41+
42+
}
43+
44+
new C();
45+
46+
assert.sameValue(ord.length, 11);
47+
ord.forEach(assert.sameValue);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-received-value.case
3+
// - src/decorator/default/cls-expr.template
4+
/*---
5+
description: Value passed to field decorators is undefined (decorator usage in a class expression)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
info: |
10+
ApplyDecoratorsToElementDefinition ( homeObject, elementRecord, extraInitializers, isStatic )
11+
12+
...
13+
14+
5. For each element decoratorRecord of decorators, do
15+
a. Let decorator be decoratorRecord.[[Decorator]].
16+
b. Let decoratorReceiver be decoratorRecord.[[Receiver]].
17+
c. Let decorationState be the Record { [[Finished]]: false }.
18+
d. Let context be CreateDecoratorContextObject(kind, key, extraInitializers, decorationState, isStatic).
19+
e. Let value be undefined.
20+
21+
...
22+
23+
j. Let newValue be ? Call(decorator, decoratorReceiver, « value, context »).
24+
25+
---*/
26+
27+
28+
function dec(value) {
29+
assert.sameValue(value, undefined);
30+
}
31+
32+
33+
var C = class {
34+
@dec foo;
35+
@dec bar = 123;
36+
37+
@dec static foo;
38+
@dec static bar = 123;
39+
}
40+
41+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-static-initializer-order.case
3+
// - src/decorator/default/cls-expr.template
4+
/*---
5+
description: Decorated field static initializers interleave with static blocks (decorator usage in a class expression)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
---*/
10+
11+
12+
var ord = [];
13+
14+
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) {
15+
ord.push(evalOrd);
16+
17+
return (value, context) => {
18+
ord.push(applyOrd);
19+
20+
context.addInitializer(() => ord.push(extraOrd));
21+
22+
return () => {
23+
ord.push(initOrd);
24+
}
25+
}
26+
}
27+
28+
29+
var C = class {
30+
static {
31+
ord.push(4)
32+
}
33+
34+
@pushOrd(0, 3, 6, 9)
35+
@pushOrd(1, 2, 7, 8)
36+
static foo = ord.push(5);
37+
38+
static {
39+
ord.push(10)
40+
}
41+
42+
}
43+
44+
assert.sameValue(ord.length, 11);
45+
ord.forEach(assert.sameValue);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-instance-initializer-order.case
3+
// - src/decorator/with-super-class/cls-expr.template
4+
/*---
5+
description: Decorated field instance initializers run after super, before constructor (decorator usage in a class expression)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
---*/
10+
11+
12+
var ord = [];
13+
14+
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) {
15+
ord.push(evalOrd);
16+
17+
return (value, context) => {
18+
ord.push(applyOrd);
19+
20+
context.addInitializer(() => ord.push(extraOrd));
21+
22+
return () => {
23+
ord.push(initOrd);
24+
}
25+
}
26+
}
27+
28+
29+
class B {}
30+
31+
var C = class extends B {
32+
constructor() {
33+
ord.push(4);
34+
super();
35+
ord.push(10);
36+
}
37+
38+
@pushOrd(0, 3, 6, 9)
39+
@pushOrd(1, 2, 7, 8)
40+
foo = ord.push(5);
41+
42+
}
43+
44+
new C();
45+
46+
assert.sameValue(ord.length, 11);
47+
ord.forEach(assert.sameValue);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-context-kind.case
3+
// - src/decorator/default/cls-decl.template
4+
/*---
5+
description: Context kind is the string "field" when decorating a field (decorator usage in a class declaration)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
info: |
10+
CreateDecoratorContextObject ( kind, name, initializers, decorationState [ , isStatic ] )
11+
12+
...
13+
14+
6. Else if kind is field, then
15+
a. Let kindStr be "field".
16+
17+
---*/
18+
19+
20+
function dec(_, context) {
21+
assert.sameValue(context.kind, "field");
22+
}
23+
24+
25+
class C {
26+
@dec foo;
27+
@dec bar = 123;
28+
29+
@dec static foo;
30+
@dec static bar = 123;
31+
}
32+
33+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-initializers-interleave.case
3+
// - src/decorator/default/cls-decl.template
4+
/*---
5+
description: Decorated field initializers are interleaved with undecorated fields (decorator usage in a class declaration)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
---*/
10+
11+
12+
var ord = [];
13+
14+
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) {
15+
ord.push(evalOrd);
16+
17+
return (value, context) => {
18+
ord.push(applyOrd);
19+
20+
context.addInitializer(() => ord.push(extraOrd));
21+
22+
return () => {
23+
ord.push(initOrd);
24+
}
25+
}
26+
}
27+
28+
29+
class C {
30+
@pushOrd(0, 5, 9, 12)
31+
@pushOrd(1, 4, 10, 11)
32+
foo = ord.push(8);
33+
34+
bar = ord.push(13);
35+
36+
@pushOrd(2, 7, 15, 18)
37+
@pushOrd(3, 6, 16, 17)
38+
baz = ord.push(14)
39+
40+
}
41+
42+
new C();
43+
44+
assert.sameValue(ord.length, 19);
45+
ord.forEach(assert.sameValue);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// This file was procedurally generated from the following sources:
2+
// - src/decorator/field-received-value.case
3+
// - src/decorator/default/cls-decl.template
4+
/*---
5+
description: Value passed to field decorators is undefined (decorator usage in a class declaration)
6+
esid: prod-FieldDefinition
7+
features: [decorators, class]
8+
flags: [generated]
9+
info: |
10+
ApplyDecoratorsToElementDefinition ( homeObject, elementRecord, extraInitializers, isStatic )
11+
12+
...
13+
14+
5. For each element decoratorRecord of decorators, do
15+
a. Let decorator be decoratorRecord.[[Decorator]].
16+
b. Let decoratorReceiver be decoratorRecord.[[Receiver]].
17+
c. Let decorationState be the Record { [[Finished]]: false }.
18+
d. Let context be CreateDecoratorContextObject(kind, key, extraInitializers, decorationState, isStatic).
19+
e. Let value be undefined.
20+
21+
...
22+
23+
j. Let newValue be ? Call(decorator, decoratorReceiver, « value, context »).
24+
25+
---*/
26+
27+
28+
function dec(value) {
29+
assert.sameValue(value, undefined);
30+
}
31+
32+
33+
class C {
34+
@dec foo;
35+
@dec bar = 123;
36+
37+
@dec static foo;
38+
@dec static bar = 123;
39+
}
40+
41+

0 commit comments

Comments
 (0)