Skip to content
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 syntax tests for import.defer #4374

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

nicolo-ribaudo
Copy link
Member

These tests are all based on the existing dynamic import syntax tests, just updated to use the new syntax.

This PR does not contain any manually written tests -- they are all generated.

Ref #4215

@nicolo-ribaudo nicolo-ribaudo requested a review from a team as a code owner January 10, 2025 16:59
@nicolo-ribaudo nicolo-ribaudo mentioned this pull request Jan 10, 2025
38 tasks
@nicolo-ribaudo nicolo-ribaudo linked an issue Jan 10, 2025 that may be closed by this pull request
38 tasks
@nicolo-ribaudo nicolo-ribaudo force-pushed the import-defer-syntax-tests branch from 919e9f8 to a9a33ed Compare January 24, 2025 10:44
Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor comments, otherwise looks good.

(I reviewed only the .case files, and only glanced at the generated tests.)

template: syntax/invalid
info: |
ImportCall :
import . source ( AssignmentExpression[+In, ?Yield] )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import . source ( AssignmentExpression[+In, ?Yield] )
import . defer ( AssignmentExpression[+In, ?Yield, ?Await] )

Comment on lines 10 to 14
//- setup
// This is still valid in script code, and should not be valid for module code
// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames
var smoosh; function smoosh() {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not realize that we had automatic setup and teardown substitution variables in the test generator! (They are documented; I just never noticed.)

Anyway, not having flags: [module] in the test seems like it's sufficient for ensuring it's executed as script code, so is this really needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from the import.source tests (these .case files are basically a copy-paste of those). It is also use in the import tests. I'm going to remove it from the import.defer tests, but probably it should then also be removed from those, since it's indeed useless (unless we want to catch broken test262 runners).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, would you like to make a follow-up PR for that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open an issue assigned to myself for now :P

@takikawa
Copy link
Contributor

I tried running this on the WebKit prototype implementation and the implementation and tests agreed, so looks good from that perspective.

Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

These tests are all based on the existing dynamic import syntax tests, just updated to use the new syntax.

This PR does not contain any manually written tests -- they are all generated.
@ptomato ptomato force-pushed the import-defer-syntax-tests branch from 5b558ea to a9d3eb6 Compare February 4, 2025 19:32
@ptomato ptomato merged commit 573058e into tc39:main Feb 4, 2025
11 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the import-defer-syntax-tests branch February 4, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

import defer testing plan
3 participants