mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 04:54:44 +02:00
Coverage: new await ...
and new (await ...)
. Fixes gh-1898
This commit is contained in:
parent
6397602037
commit
758b9ec575
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-AwaitExpression
|
||||
description: >
|
||||
`new (await Constructor)` returns instance of Constructor
|
||||
flags: [module, async]
|
||||
features: [top-level-await]
|
||||
---*/
|
||||
|
||||
assert.sameValue((new (await Number)).valueOf(), 0);
|
||||
assert.sameValue((new (await String)).valueOf(), '');
|
||||
assert.sameValue((new (await Boolean)).valueOf(), false);
|
||||
assert.sameValue((new (await Array)).length, 0);
|
||||
assert.sameValue((new (await Map)).size, 0);
|
||||
assert.sameValue((new (await Set)).size, 0);
|
||||
|
||||
$DONE();
|
@ -0,0 +1,13 @@
|
||||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-AwaitExpression
|
||||
description: >
|
||||
await is not a keyword in script code
|
||||
features: [top-level-await]
|
||||
---*/
|
||||
|
||||
class await {}
|
||||
|
||||
assert.sameValue(new await instanceof await, true);
|
17
test/language/module-code/top-level-await/new-await.js
Normal file
17
test/language/module-code/top-level-await/new-await.js
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-AwaitExpression
|
||||
description: >
|
||||
await cannot immediately follow new in module code
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [module]
|
||||
features: [top-level-await]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
new await;
|
Loading…
x
Reference in New Issue
Block a user