mirror of https://github.com/tc39/test262.git
Coverage: lexical arguments, new.target, in async arrow functions. Fixes gh-1737
This commit is contained in:
parent
ad8a5e9940
commit
74a4152703
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -17,6 +17,6 @@ info: |
|
|||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
async() => {
|
||||
async (/*{ params }*/) => {
|
||||
/*{ body }*/
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -13,6 +13,6 @@ info: |
|
|||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
async function fn() {
|
||||
async function asyncFn(/*{ params }*/) {
|
||||
/*{ body }*/
|
||||
}
|
||||
|
|
|
@ -13,6 +13,6 @@ info: |
|
|||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
var fn = async function fn() {
|
||||
var asyncFn = async function asyncFn(/*{ params }*/) {
|
||||
/*{ body }*/
|
||||
};
|
||||
|
|
|
@ -13,6 +13,6 @@ info: |
|
|||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
var fn = async function () {
|
||||
var asyncFn = async function (/*{ params }*/) {
|
||||
/*{ body }*/
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue