-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1c3592
commit b4a6e52
Showing
10 changed files
with
151 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Tests for ECMAScript 2020 `import.meta` | ||
|
||
if (typeof exports != 'undefined') { | ||
var test = require('./driver.js').test; | ||
var testFail = require('./driver.js').testFail; | ||
} | ||
|
||
test( | ||
"import.meta", | ||
{ | ||
"type": "Program", | ||
"start": 0, | ||
"end": 11, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 11, | ||
"expression": { | ||
"type": "MetaProperty", | ||
"start": 0, | ||
"end": 11, | ||
"meta": { | ||
"type": "Identifier", | ||
"start": 0, | ||
"end": 6, | ||
"name": "import" | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 7, | ||
"end": 11, | ||
"name": "meta" | ||
} | ||
} | ||
} | ||
], | ||
"sourceType": "module" | ||
}, | ||
{ ecmaVersion: 11, sourceType: "module" } | ||
); | ||
|
||
test( | ||
"import.meta.url", | ||
{ | ||
"type": "Program", | ||
"start": 0, | ||
"end": 15, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 15, | ||
"expression": { | ||
"type": "MemberExpression", | ||
"start": 0, | ||
"end": 15, | ||
"object": { | ||
"type": "MetaProperty", | ||
"start": 0, | ||
"end": 11, | ||
"meta": { | ||
"type": "Identifier", | ||
"start": 0, | ||
"end": 6, | ||
"name": "import" | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 7, | ||
"end": 11, | ||
"name": "meta" | ||
} | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 12, | ||
"end": 15, | ||
"name": "url" | ||
}, | ||
"computed": false | ||
} | ||
} | ||
], | ||
"sourceType": "module" | ||
}, | ||
{ ecmaVersion: 11, sourceType: "module" } | ||
); | ||
|
||
testFail("import.meta", "Unexpected token (1:6)", { ecmaVersion: 10, sourceType: "module" }); | ||
testFail("import.meta", "Cannot use 'import.meta' outside a module (1:0)", { ecmaVersion: 11, sourceType: "script" }); | ||
testFail("import['meta']", "Unexpected token (1:6)", { ecmaVersion: 11, sourceType: "module" }); | ||
testFail("a = import['meta']", "Unexpected token (1:10)", { ecmaVersion: 11, sourceType: "module" }); | ||
testFail("import.target", "The only valid meta property for import is 'import.meta' (1:7)", { ecmaVersion: 11, sourceType: "module" }); | ||
testFail("new.meta", "The only valid meta property for new is 'new.target' (1:4)", { ecmaVersion: 11, sourceType: "module" }); | ||
testFail("im\\u0070ort.meta", "Escape sequence in keyword import (1:0)", { ecmaVersion: 11, sourceType: "module" }); | ||
testFail("import.\\u006d\\u0065\\u0074\\u0061", "'import.meta' must not contain escaped characters (1:0)", { ecmaVersion: 11, sourceType: "module" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters