-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEMP: Autogenerated tests without templates
- Loading branch information
Showing
12 changed files
with
556 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
test/language/expressions/class/decorator/field-context-kind.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-context-kind.case | ||
// - src/decorator/default/cls-expr.template | ||
/*--- | ||
description: Context kind is the string "field" when decorating a field (decorator usage in a class expression) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
info: | | ||
CreateDecoratorContextObject ( kind, name, initializers, decorationState [ , isStatic ] ) | ||
... | ||
6. Else if kind is field, then | ||
a. Let kindStr be "field". | ||
---*/ | ||
|
||
|
||
function dec(_, context) { | ||
assert.sameValue(context.kind, "field"); | ||
} | ||
|
||
|
||
var C = class { | ||
@dec foo; | ||
@dec bar = 123; | ||
|
||
@dec static foo; | ||
@dec static bar = 123; | ||
} | ||
|
||
|
45 changes: 45 additions & 0 deletions
45
test/language/expressions/class/decorator/field-initializers-interleave.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-initializers-interleave.case | ||
// - src/decorator/default/cls-expr.template | ||
/*--- | ||
description: Decorated field initializers are interleaved with undecorated fields (decorator usage in a class expression) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
---*/ | ||
|
||
|
||
var ord = []; | ||
|
||
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) { | ||
ord.push(evalOrd); | ||
|
||
return (value, context) => { | ||
ord.push(applyOrd); | ||
|
||
context.addInitializer(() => ord.push(extraOrd)); | ||
|
||
return () => { | ||
ord.push(initOrd); | ||
} | ||
} | ||
} | ||
|
||
|
||
var C = class { | ||
@pushOrd(0, 5, 9, 12) | ||
@pushOrd(1, 4, 10, 11) | ||
foo = ord.push(8); | ||
|
||
bar = ord.push(13); | ||
|
||
@pushOrd(2, 7, 15, 18) | ||
@pushOrd(3, 6, 16, 17) | ||
baz = ord.push(14) | ||
|
||
} | ||
|
||
new C(); | ||
|
||
assert.sameValue(ord.length, 19); | ||
ord.forEach(assert.sameValue); |
47 changes: 47 additions & 0 deletions
47
test/language/expressions/class/decorator/field-instance-initializer-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-instance-initializer-order.case | ||
// - src/decorator/with-super-class/cls-expr.template | ||
/*--- | ||
description: Decorated field instance initializers run after super, before constructor (decorator usage in a class expression) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
---*/ | ||
|
||
|
||
var ord = []; | ||
|
||
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) { | ||
ord.push(evalOrd); | ||
|
||
return (value, context) => { | ||
ord.push(applyOrd); | ||
|
||
context.addInitializer(() => ord.push(extraOrd)); | ||
|
||
return () => { | ||
ord.push(initOrd); | ||
} | ||
} | ||
} | ||
|
||
|
||
class B {} | ||
|
||
var C = class extends B { | ||
@pushOrd(0, 3, 6, 9) | ||
@pushOrd(1, 2, 7, 8) | ||
foo = ord.push(5); | ||
|
||
constructor() { | ||
ord.push(4); | ||
super(); | ||
ord.push(10) | ||
} | ||
|
||
} | ||
|
||
new C(); | ||
|
||
assert.sameValue(ord.length, 11); | ||
ord.forEach(assert.sameValue); |
41 changes: 41 additions & 0 deletions
41
test/language/expressions/class/decorator/field-received-value.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-received-value.case | ||
// - src/decorator/default/cls-expr.template | ||
/*--- | ||
description: Value passed to field decorators is undefined (decorator usage in a class expression) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
info: | | ||
ApplyDecoratorsToElementDefinition ( homeObject, elementRecord, extraInitializers, isStatic ) | ||
... | ||
5. For each element decoratorRecord of decorators, do | ||
a. Let decorator be decoratorRecord.[[Decorator]]. | ||
b. Let decoratorReceiver be decoratorRecord.[[Receiver]]. | ||
c. Let decorationState be the Record { [[Finished]]: false }. | ||
d. Let context be CreateDecoratorContextObject(kind, key, extraInitializers, decorationState, isStatic). | ||
e. Let value be undefined. | ||
... | ||
j. Let newValue be ? Call(decorator, decoratorReceiver, « value, context »). | ||
---*/ | ||
|
||
|
||
function dec(value) { | ||
assert.sameValue(value, undefined); | ||
} | ||
|
||
|
||
var C = class { | ||
@dec foo; | ||
@dec bar = 123; | ||
|
||
@dec static foo; | ||
@dec static bar = 123; | ||
} | ||
|
||
|
45 changes: 45 additions & 0 deletions
45
test/language/expressions/class/decorator/field-static-initializer-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-static-initializer-order.case | ||
// - src/decorator/default/cls-expr.template | ||
/*--- | ||
description: Decorated field static initializers interleave with static blocks (decorator usage in a class expression) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
---*/ | ||
|
||
|
||
var ord = []; | ||
|
||
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) { | ||
ord.push(evalOrd); | ||
|
||
return (value, context) => { | ||
ord.push(applyOrd); | ||
|
||
context.addInitializer(() => ord.push(extraOrd)); | ||
|
||
return () => { | ||
ord.push(initOrd); | ||
} | ||
} | ||
} | ||
|
||
|
||
var C = class { | ||
static { | ||
ord.push(4) | ||
} | ||
|
||
@pushOrd(0, 3, 6, 9) | ||
@pushOrd(1, 2, 7, 8) | ||
static foo = ord.push(5); | ||
|
||
static { | ||
ord.push(10) | ||
} | ||
|
||
} | ||
|
||
assert.sameValue(ord.length, 11); | ||
ord.forEach(assert.sameValue); |
47 changes: 47 additions & 0 deletions
47
...language/expressions/class/decorator/with-super-class/field-instance-initializer-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-instance-initializer-order.case | ||
// - src/decorator/with-super-class/cls-expr.template | ||
/*--- | ||
description: Decorated field instance initializers run after super, before constructor (decorator usage in a class expression) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
---*/ | ||
|
||
|
||
var ord = []; | ||
|
||
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) { | ||
ord.push(evalOrd); | ||
|
||
return (value, context) => { | ||
ord.push(applyOrd); | ||
|
||
context.addInitializer(() => ord.push(extraOrd)); | ||
|
||
return () => { | ||
ord.push(initOrd); | ||
} | ||
} | ||
} | ||
|
||
|
||
class B {} | ||
|
||
var C = class extends B { | ||
constructor() { | ||
ord.push(4); | ||
super(); | ||
ord.push(10); | ||
} | ||
|
||
@pushOrd(0, 3, 6, 9) | ||
@pushOrd(1, 2, 7, 8) | ||
foo = ord.push(5); | ||
|
||
} | ||
|
||
new C(); | ||
|
||
assert.sameValue(ord.length, 11); | ||
ord.forEach(assert.sameValue); |
33 changes: 33 additions & 0 deletions
33
test/language/statements/class/decorator/field-context-kind.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-context-kind.case | ||
// - src/decorator/default/cls-decl.template | ||
/*--- | ||
description: Context kind is the string "field" when decorating a field (decorator usage in a class declaration) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
info: | | ||
CreateDecoratorContextObject ( kind, name, initializers, decorationState [ , isStatic ] ) | ||
... | ||
6. Else if kind is field, then | ||
a. Let kindStr be "field". | ||
---*/ | ||
|
||
|
||
function dec(_, context) { | ||
assert.sameValue(context.kind, "field"); | ||
} | ||
|
||
|
||
class C { | ||
@dec foo; | ||
@dec bar = 123; | ||
|
||
@dec static foo; | ||
@dec static bar = 123; | ||
} | ||
|
||
|
45 changes: 45 additions & 0 deletions
45
test/language/statements/class/decorator/field-initializers-interleave.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-initializers-interleave.case | ||
// - src/decorator/default/cls-decl.template | ||
/*--- | ||
description: Decorated field initializers are interleaved with undecorated fields (decorator usage in a class declaration) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
---*/ | ||
|
||
|
||
var ord = []; | ||
|
||
function pushOrd(evalOrd, applyOrd, initOrd, extraOrd) { | ||
ord.push(evalOrd); | ||
|
||
return (value, context) => { | ||
ord.push(applyOrd); | ||
|
||
context.addInitializer(() => ord.push(extraOrd)); | ||
|
||
return () => { | ||
ord.push(initOrd); | ||
} | ||
} | ||
} | ||
|
||
|
||
class C { | ||
@pushOrd(0, 5, 9, 12) | ||
@pushOrd(1, 4, 10, 11) | ||
foo = ord.push(8); | ||
|
||
bar = ord.push(13); | ||
|
||
@pushOrd(2, 7, 15, 18) | ||
@pushOrd(3, 6, 16, 17) | ||
baz = ord.push(14) | ||
|
||
} | ||
|
||
new C(); | ||
|
||
assert.sameValue(ord.length, 19); | ||
ord.forEach(assert.sameValue); |
41 changes: 41 additions & 0 deletions
41
test/language/statements/class/decorator/field-received-value.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/decorator/field-received-value.case | ||
// - src/decorator/default/cls-decl.template | ||
/*--- | ||
description: Value passed to field decorators is undefined (decorator usage in a class declaration) | ||
esid: prod-FieldDefinition | ||
features: [decorators, class] | ||
flags: [generated] | ||
info: | | ||
ApplyDecoratorsToElementDefinition ( homeObject, elementRecord, extraInitializers, isStatic ) | ||
... | ||
5. For each element decoratorRecord of decorators, do | ||
a. Let decorator be decoratorRecord.[[Decorator]]. | ||
b. Let decoratorReceiver be decoratorRecord.[[Receiver]]. | ||
c. Let decorationState be the Record { [[Finished]]: false }. | ||
d. Let context be CreateDecoratorContextObject(kind, key, extraInitializers, decorationState, isStatic). | ||
e. Let value be undefined. | ||
... | ||
j. Let newValue be ? Call(decorator, decoratorReceiver, « value, context »). | ||
---*/ | ||
|
||
|
||
function dec(value) { | ||
assert.sameValue(value, undefined); | ||
} | ||
|
||
|
||
class C { | ||
@dec foo; | ||
@dec bar = 123; | ||
|
||
@dec static foo; | ||
@dec static bar = 123; | ||
} | ||
|
||
|
Oops, something went wrong.