Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-arguments.js

raw
1 // Copyright (C) 2018 Leo Balter. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: >
5 ImportCall is a CallExpression and can be used before arguments
6 esid: prod-ImportCall
7 info: |
8 CallExpression:
9 ImportCall
10 CallExpression TemplateLiteral
11 CallExpression Arguments
12 features: [dynamic-import]
13 ---*/
14
15 // valid syntax, but fails on runtime evaluation
16
17 assert.throws(TypeError, () => {
18 import('./empty_FIXTURE.js')();
19 }, 'empty arguments');
20
21 assert.throws(TypeError, () => {
22 import('./empty_FIXTURE.js')(1,);
23 }, 'arguments with trailing comma');
24
25 assert.throws(TypeError, () => {
26 import('./empty_FIXTURE.js')(1, 2);
27 }, '2 arguments');
28
29 assert.throws(TypeError, () => {
30 import('./empty_FIXTURE.js')(...[]);
31 }, 'spread args');
32
33 reportCompare(0, 0);