Coverage: lexical arguments, new.target, in async arrow functions. Fixes gh-1737

This commit is contained in:
Rick Waldron 2020-09-25 17:05:08 -04:00
parent ad8a5e9940
commit 74a4152703
19 changed files with 251 additions and 22 deletions

View File

@ -0,0 +1,30 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
desc: >
Async function returns an async function.
templates:
- syntax/async-class-*.template
- syntax/async-declaration.template
- syntax/async-expression-*.template
- syntax/async-obj-method.template
flags: [async]
---*/
//- setup
let count = 0;
//- params
x
//- body
let a = arguments;
return async () => a === arguments;
//- teardown
asyncFn().then(retFn => {
count++;
return retFn();
}).then(result => {
assert.sameValue(result, true);
assert.sameValue(count, 1);
}).then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
desc: >
Async function returns an async function.
templates:
- syntax/async-class-*.template
- syntax/async-declaration.template
- syntax/async-expression-*.template
- syntax/async-obj-method.template
flags: [async]
---*/
//- setup
let count = 0;
//- params
x
//- body
return async () => new.target;
//- teardown
asyncFn().then(retFn => {
count++;
return retFn();
}).then(result => {
assert.sameValue(result, undefined);
assert.sameValue(count, 1);
}).then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
desc: >
Async function returns an async function.
templates:
- syntax/async-class-*.template
- syntax/async-declaration.template
- syntax/async-expression-*.template
- syntax/async-obj-method.template
flags: [async]
---*/
//- setup
let count = 0;
//- params
x
//- body
return async () => x;
//- teardown
asyncFn(1).then(retFn => {
count++;
return retFn();
}).then(result => {
assert.sameValue(result, 1);
assert.sameValue(count, 1);
}).then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
desc: >
Async function returns an async function.
templates:
- syntax/async-class-*.template
- syntax/async-declaration.template
- syntax/async-expression-*.template
- syntax/async-obj-method.template
flags: [async]
---*/
//- setup
let count = 0;
//- params
x
//- body
let a = arguments;
return async function() { return a === arguments; };
//- teardown
asyncFn(1).then(retFn => {
count++;
return retFn();
}).then(result => {
assert.sameValue(result, false);
assert.sameValue(count, 1);
}).then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
desc: >
Async function returns an async function.
templates:
- syntax/async-class-*.template
- syntax/async-declaration.template
- syntax/async-expression-*.template
- syntax/async-obj-method.template
flags: [async]
---*/
//- setup
let count = 0;
//- params
x
//- body
return async function() { return new.target; };
//- teardown
asyncFn(1).then(retFn => {
count++;
return retFn();
}).then(result => {
assert.sameValue(result, undefined);
assert.sameValue(count, 1);
}).then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
desc: >
Async function returns an async function.
templates:
- syntax/async-class-*.template
- syntax/async-declaration.template
- syntax/async-expression-*.template
- syntax/async-obj-method.template
flags: [async]
---*/
//- setup
let count = 0;
//- params
x
//- body
return async function() { return x; };
//- teardown
asyncFn(1).then(retFn => {
count++;
return retFn();
}).then(result => {
assert.sameValue(result, 1);
assert.sameValue(count, 1);
}).then($DONE, $DONE);

View File

@ -17,6 +17,6 @@ info: |
features: [async-functions]
---*/
async() => {
async (/*{ params }*/) => {
/*{ body }*/
};
}

View File

@ -19,6 +19,11 @@ info: |
features: [async-functions]
---*/
class C { async method() {
class C {
async method(/*{ params }*/) {
/*{ body }*/
}}
}
}
// Stores a reference `asyncFn` for case evaluation
let c = new C();
let asyncFn = c.method.bind(c);

View File

@ -19,6 +19,14 @@ info: |
features: [async-functions, class-methods-private]
---*/
class C { async #method() {
class C {
async #method(/*{ params }*/) {
/*{ body }*/
}}
}
async method(/*{ params }*/) {
return this.#method(/*{ params }*/);
}
}
// Stores a reference `asyncFn` for case evaluation
let c = new C();
let asyncFn = c.method.bind(c);

View File

@ -19,6 +19,11 @@ info: |
features: [async-functions]
---*/
class C { static async method() {
class C {
static async method(/*{ params }*/) {
/*{ body }*/
}}
}
}
// Stores a reference `asyncFn` for case evaluation
let asyncFn = C.method;

View File

@ -19,6 +19,14 @@ info: |
features: [async-functions, class-static-methods-private]
---*/
class C { static async #method() {
class C {
static async #method(/*{ params }*/) {
/*{ body }*/
}}
}
static async method(/*{ params }*/) {
return this.#method(/*{ params }*/);
}
}
// Stores a reference `asyncFn` for case evaluation
let asyncFn = C.method.bind(C);

View File

@ -19,6 +19,12 @@ info: |
features: [async-functions]
---*/
var C = class { async method() {
var C = class {
async method(/*{ params }*/) {
/*{ body }*/
}};
}
};
// Stores a reference `asyncFn` for case evaluation
let c = new C();
let asyncFn = c.method.bind(c);

View File

@ -19,6 +19,14 @@ info: |
features: [async-functions, class-methods-private]
---*/
var C = class { async #method() {
var C = class {
async #method(/*{ params }*/) {
/*{ body }*/
}};
}
async method(/*{ params }*/) {
return this.#method(/*{ params }*/);
}
};
// Stores a reference `asyncFn` for case evaluation
let c = new C();
let asyncFn = c.method.bind(c);

View File

@ -19,6 +19,10 @@ info: |
features: [async-functions]
---*/
var C = class { static async method() {
var C = class {
static async method(/*{ params }*/) {
/*{ body }*/
}};
}
};
// Stores a reference `asyncFn` for case evaluation
let asyncFn = C.method;

View File

@ -19,6 +19,13 @@ info: |
features: [async-functions, class-static-methods-private]
---*/
var C = class { static async #method() {
var C = class {
static async #method(/*{ params }*/) {
/*{ body }*/
}};
}
static async method(/*{ params }*/) {
return this.#method(/*{ params }*/);
}
}
// Stores a reference `asyncFn` for case evaluation
let asyncFn = C.method.bind(C);

View File

@ -13,6 +13,6 @@ info: |
features: [async-functions]
---*/
async function fn() {
async function asyncFn(/*{ params }*/) {
/*{ body }*/
}

View File

@ -13,6 +13,6 @@ info: |
features: [async-functions]
---*/
var fn = async function fn() {
var asyncFn = async function asyncFn(/*{ params }*/) {
/*{ body }*/
};

View File

@ -13,6 +13,6 @@ info: |
features: [async-functions]
---*/
var fn = async function () {
var asyncFn = async function (/*{ params }*/) {
/*{ body }*/
};

View File

@ -14,7 +14,9 @@ features: [async-functions]
---*/
var obj = {
async method() {
async method(/*{ params }*/) {
/*{ body }*/
}
};
// Stores a reference `asyncFn` for case evaluation
let asyncFn = obj.method;