mirror of
https://github.com/tc39/test262.git
synced 2025-07-22 13:34:38 +02:00
add tests for for ( async of
This commit is contained in:
parent
df1961f16a
commit
96f1e2713b
15
test/language/statements/for-of/head-lhs-async-dot.js
Normal file
15
test/language/statements/for-of/head-lhs-async-dot.js
Normal file
@ -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);
|
17
test/language/statements/for-of/head-lhs-async-invalid.js
Normal file
17
test/language/statements/for-of/head-lhs-async-invalid.js
Normal file
@ -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]) ;
|
16
test/language/statements/for/head-init-async-of.js
Normal file
16
test/language/statements/for/head-init-async-of.js
Normal file
@ -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…
x
Reference in New Issue
Block a user