test262/test/language/eval-code/indirect/parse-failure-6.js
QuXing9 91a9abff4e
Add three testcases for test262 suite. (#2692)
* Add tests for escape function when parameter is not a string.

Fixes #2687
Fixes #2637

* Add test for indirect eval calls  when script is a for statement.

When for statement doesn't have a body, it should throw a SyntaxError.

Fixes #2661

* Add tests for Function Constructor when body contains usestrict.

Fixes #2688
Fixes #2638
2020-07-09 09:57:55 -07:00

18 lines
690 B
JavaScript

// Copyright 2020 Qu Xing. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-performeval
description: For statement
info: |
...
9. Perform the following substeps in an implementation-dependent order, possibly interleaving parsing and error detection:
a. Let script be the ECMAScript code that is the result of parsing ! UTF16DecodeString(x),for the goal symbol Script.
If the parse fails, throw a SyntaxError exception. If any early errors are detected, throw a SyntaxError exception
(but see also clause 16).
...
---*/
assert.throws(SyntaxError, function() {
(0, eval)("for(;false;)");
});