mirror of https://github.com/tc39/test262.git
add tests for `for ( async of`
This commit is contained in:
parent
df1961f16a
commit
96f1e2713b
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2021 Kevin Gibbons. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: leading `async` token in for-of LHS
|
||||
info: |
|
||||
The `async` token is allowed in the LHS if not followed by `of`
|
||||
esid: sec-for-in-and-for-of-statements
|
||||
---*/
|
||||
|
||||
var async = { x: 0 };
|
||||
|
||||
for (async.x of [1]) ;
|
||||
|
||||
assert.sameValue(async.x, 1);
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2021 Kevin Gibbons. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: leading `async` token in for-of LHS
|
||||
info: |
|
||||
The `async` token is disallowed in the LHS when followed by `of`
|
||||
esid: sec-for-in-and-for-of-statements
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var async;
|
||||
for (async of [1]) ;
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2021 Kevin Gibbons. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: for statement beginning with `async of`
|
||||
info: |
|
||||
`for (async of =>` is the begining of a regular for loop, rather than a for-of
|
||||
esid: sec-for-statement
|
||||
---*/
|
||||
|
||||
var i = 0;
|
||||
var counter = 0;
|
||||
for (async of => {}; i < 10; ++i) {
|
||||
++counter;
|
||||
}
|
||||
assert.sameValue(counter, 10);
|
Loading…
Reference in New Issue