Add cases for ImportCall syntax reused in CallExpressions

This commit is contained in:
Leo Balter 2018-10-24 18:48:08 -04:00 committed by Rick Waldron
parent ca87891961
commit 09e608edad
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,31 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
ImportCall is a CallExpression and can be used before arguments
esid: prod-ImportCall
info: |
CallExpression:
ImportCall
CallExpression TemplateLiteral
CallExpression Arguments
features: [dynamic-import]
---*/
// valid syntax, but fails on runtime evaluation
assert.throws(TypeError, () => {
import('./empty_FIXTURE.js')();
}, 'empty arguments');
assert.throws(TypeError, () => {
import('./empty_FIXTURE.js')(1,);
}, 'arguments with trailing comma');
assert.throws(TypeError, () => {
import('./empty_FIXTURE.js')(1, 2);
}, '2 arguments');
assert.throws(TypeError, () => {
import('./empty_FIXTURE.js')(...[]);
}, 'spread args');

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
ImportCall is a CallExpression and can be used before a template literal
esid: prod-ImportCall
info: |
CallExpression:
ImportCall
CallExpression TemplateLiteral
CallExpression Arguments
features: [dynamic-import]
---*/
// valid syntax, but fails on runtime evaluation
assert.throws(TypeError, () => {
import('./empty_FIXTURE.js')``;
});
assert.throws(TypeError, () => {
import('./empty_FIXTURE.js')`something`;
});
assert.throws(TypeError, () => {
import('./empty_FIXTURE.js')`${42}`;
});