Added generated tests

This commit is contained in:
Caio Lima 2019-02-06 17:18:13 -02:00
parent 9fe84c576a
commit 442c3539a3
10 changed files with 380 additions and 0 deletions

View File

@ -0,0 +1,33 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-arrow-function.case
// - src/class-elements/default/cls-expr.template
/*---
description: Calling arrow function returned from private field access (field definitions in a class expression)
esid: prod-FieldDefinition
features: [class-fields-private, arrow-function, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
var C = class {
#m = () => 'test262';
method() {
return this.#m();
}
}
let c = new C();
assert.sameValue(c.method(), 'test262');

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-async-arrow-function.case
// - src/class-elements/default/cls-expr.template
/*---
description: Calling async arrow function returned from private field access (field definitions in a class expression)
esid: prod-FieldDefinition
features: [class-fields-private, async-functions, arrow-function, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
var C = class {
#m = async () => 'test262';
method() {
return this.#m();
}
}
let c = new C();
async function asyncRun() {
assert.sameValue(await c.method(), 'test262');
}
asyncRun();

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-async-function.case
// - src/class-elements/default/cls-expr.template
/*---
description: Calling async function returned from private field access (field definitions in a class expression)
esid: prod-FieldDefinition
features: [class-fields-private, async-functions, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
var C = class {
#m = async function() { return 'test262'; };
method() {
return this.#m();
}
}
let c = new C();
async function asyncRun() {
assert.sameValue(await c.method(), 'test262');
}
asyncRun();

View File

@ -0,0 +1,33 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-function.case
// - src/class-elements/default/cls-expr.template
/*---
description: Calling result returned from private field access (field definitions in a class expression)
esid: prod-FieldDefinition
features: [class-fields-private, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
var C = class {
#m = function () { return 'test262'; };
method() {
return this.#m();
}
}
let c = new C();
assert.sameValue(c.method(), 'test262');

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-super-access-throws.case
// - src/class-elements/default/cls-expr.template
/*---
description: Acessing private field from super shoudl throw an error (field definitions in a class expression)
esid: prod-FieldDefinition
features: [class-fields-private, class-fields-public, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
var C = class {
#m = function() { return 'test262'; };
Child = class extends C {
access() {
return super.#m;
}
method() {
return super.#m();
}
}
}
assert.throws(TypeError, function() {
(new (new C()).Child).method();
}, 'super.#m() throws TypeError');
assert.throws(TypeError, function() {
(new (new C()).Child).access();
}, 'super.#m throws TypeError');

View File

@ -0,0 +1,33 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-arrow-function.case
// - src/class-elements/default/cls-decl.template
/*---
description: Calling arrow function returned from private field access (field definitions in a class declaration)
esid: prod-FieldDefinition
features: [class-fields-private, arrow-function, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
class C {
#m = () => 'test262';
method() {
return this.#m();
}
}
let c = new C();
assert.sameValue(c.method(), 'test262');

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-async-arrow-function.case
// - src/class-elements/default/cls-decl.template
/*---
description: Calling async arrow function returned from private field access (field definitions in a class declaration)
esid: prod-FieldDefinition
features: [class-fields-private, async-functions, arrow-function, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
class C {
#m = async () => 'test262';
method() {
return this.#m();
}
}
let c = new C();
async function asyncRun() {
assert.sameValue(await c.method(), 'test262');
}
asyncRun();

View File

@ -0,0 +1,39 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-async-function.case
// - src/class-elements/default/cls-decl.template
/*---
description: Calling async function returned from private field access (field definitions in a class declaration)
esid: prod-FieldDefinition
features: [class-fields-private, async-functions, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
class C {
#m = async function() { return 'test262'; };
method() {
return this.#m();
}
}
let c = new C();
async function asyncRun() {
assert.sameValue(await c.method(), 'test262');
}
asyncRun();

View File

@ -0,0 +1,33 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-as-function.case
// - src/class-elements/default/cls-decl.template
/*---
description: Calling result returned from private field access (field definitions in a class declaration)
esid: prod-FieldDefinition
features: [class-fields-private, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
class C {
#m = function () { return 'test262'; };
method() {
return this.#m();
}
}
let c = new C();
assert.sameValue(c.method(), 'test262');

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/private-field-super-access-throws.case
// - src/class-elements/default/cls-decl.template
/*---
description: Acessing private field from super shoudl throw an error (field definitions in a class declaration)
esid: prod-FieldDefinition
features: [class-fields-private, class-fields-public, class]
flags: [generated]
info: |
Updated Productions
CallExpression[Yield, Await]:
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
SuperCall[?Yield, ?Await]
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
CallExpression[?Yield, ?Await].IdentifierName
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
CallExpression[?Yield, ?Await].PrivateName
---*/
class C {
#m = function() { return 'test262'; };
Child = class extends C {
access() {
return super.#m;
}
method() {
return super.#m();
}
}
}
assert.throws(TypeError, function() {
(new (new C()).Child).method();
}, 'super.#m() throws TypeError');
assert.throws(TypeError, function() {
(new (new C()).Child).access();
}, 'super.#m throws TypeError');