test262/test/built-ins/Function/StrictFunction_reservedwords_with.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

22 lines
832 B
JavaScript

// Copyright (C) 2020 Xing Qu. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-createdynamicfunction
description: Strictfunction shouldn't have the reserved word "with"
info: |
CreateDynamicFunction ( constructor, newTarget, kind, args )
...
20 Perform the following substeps in an implementation-dependent order, possibly interleaving parsing and error detection:
...
c. Let strict be ContainsUseStrict of body.
d. If any static semantics errors are detected for parameters or body, throw a SyntaxError exception.
If strict is true, the Early Error rules for UniqueFormalParameters:FormalParameters are applied.
...
...
---*/
assert.throws(SyntaxError, function() {
new Function("'use strict'; with ({}) {}");
});