New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage for dynamic import #1164

Open
leobalter opened this Issue Aug 3, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@leobalter
Copy link
Member

leobalter commented Aug 3, 2017

currently on stage 3.

https://github.com/tc39/proposal-dynamic-import

Coverage Checklist for import()

Default Templates

general places it can be found as a CallExpression

  • top level
  • consise body of an ArrowFunction
  • function body of an ArrowFunction
  • consise body of an Async ArrowFunction
  • function body of an Async ArrowFunction
  • Used in async generators
  • await position of an async function
  • return await position of an async function
  • nested in an async function
  • labeled blocks
  • blocks
  • do while
  • else braceless
  • else block
  • if braceless
  • if block
  • while block
  • inside with

Cases

Syntax

  • assignment expression is not optional assignment-expr-not-optional.case
  • empty string is a valid assignment expression (not a syntax error) empty-str-is-valid-assign-expr.case
  • Forbidden Extensions: ImportCall must not be extended. (Only one assignment expression allowed)
    • no trailing comma, it's not an arguments list (#1832)
    • no other expressions (#1832)

Common usage

  • indirect update default binding eval-gtbndng-indirect-update-dflt.case
  • indirect update named binding eval-gtbndng-indirect-update-dflt.case
  • Assignment Expression evaluations. Most can be used as syntax tests only, e.g. exprs evaluating to a boolean value) or error catching
    • ConditionalExpression
      • Primary Expressions on the import Assign. Expr. position (?)
      • Cover Parenthesis expressions
      • ...
    • YieldExpression
      • Check yield usage
    • ArrowFunction
    • AsyncArrowFunction
    • LeftHandSideExpression = AssignmentExpression
    • LeftHandSideExpression AssignmentOperator AssignmentExpression
  • ToString on the AssignmentExpression value Let specifierString be ToString(specifier).
    • If AbruptRejectPromise(specifierString, promiseCapability).
  • nest import() in CallExpressions
    • import(import(...)) (#1832)
    • ... (other CallExpressions here)
  • Goal target can be a script code (not module code)
    • in this case, it should not export anything (and it's not a SyntaxError like in static imports)
    • indirect updates
  • Goal target can be a module code (having module specific syntax)
  • module code on host syntax
  • Multiple imports on the same imported module
    • verify indirect updates
    • Imported module is only evaluated once. test/language/module-code/dynamic-import/eval-rqstd-once.js
    • Self loading module only evaluates once. test/language/module-code/dynamic-import/eval-self-once-module.js
    • Self loading script evaluates again once for import(). test/language/module-code/dynamic-import/eval-self-once-script.js
  • ImportCall in runtime returns a Promise
    • Verify ctor
    • Use in Promise.all?
    • await resolving (include failures)
    • Use Promise.prototype
    • Promise.resolve
  • Captures exported operations of .. in .. in exported values. test/language/module-code/dynamic-import/eval-export-dflt-expr-in.js
  • Does not create a default property if default export is not given
  • imported value is an object with the exported names, including default
  • Returns abrupt completion from GetValue on AssignmentExpression (not a promise reject)
  • ToString on specifier
    • Abrupt completions should reject the promise

Resolve Moduled Namespace object

  • Symbol.toStringTag
  • no Symbol.iterator
  • prop desc of imported names
  • imported symbols on own property keys internals
  • internals https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects
  • setting custom immutable prototype
  • prototype is null
  • References observe the mutation of initialized bindings ([[Get]] on bindings after changing their values)
  • The [[OwnPropertyKeys]] internal method includes entries for all binding types

Non generated tests

  • Self importing test files
    • default name binding test/language/module-code/dynamic-import/eval-export-dflt-cls-anon.js
    • test/language/module-code/dynamic-import/eval-export-dflt-cls-name-meth.js
    • test/language/module-code/dynamic-import/eval-export-dflt-cls-named.js
    • test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-anon.js
    • test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-name-meth.js
    • test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-named.js
    • test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-anon.js
    • test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-named.js
    • test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-anon.js
    • test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-named.js

Error catching

  • resolved runtime error (TypeError) eval-rqstd-abrupt-typeerror.case
  • resolved runtime error (URIError) eval-rqstd-abrupt-urierror.case
  • ambiguous import
  • circular import error
  • File does not exist (#1832)

@leobalter leobalter added the coverage label Aug 3, 2017

leobalter added a commit that referenced this issue Oct 4, 2018

rwaldron added a commit that referenced this issue Oct 4, 2018

@leobalter leobalter self-assigned this Oct 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment