Repository navigation
Add script to generate standard property tests #4535
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
Open
anba
wants to merge
8
commits into
tc39:main
Choose a base branch
from
anba:generated-builtin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0166442
Add harness functions to verify built-in functions and constructors
anba 9ad1b2b
Ignore generated files from other test generators
anba c5351e4
Add script to generate property tests
anba cfe8c2a
Generate standard property tests for Number
anba b012d8e
Generate standard property tests for ECMA-402 Number overrides
anba 933d746
Remove Number tests now covered by automatically generated tests
anba 3b224c4
Remove assertions covered by automatically generated tests
anba 8b5cdbc
Add property tests for Uint8Array to/from base64 proposal
anba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,43 @@ | ||||||||||||||||||||||||||
| # Property Test Generator | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| This tool generates standard property tests for built-in functions and objects. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Supported options: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - `--dry-run`: Don't write any output files. | ||||||||||||||||||||||||||
| - `--include`: Comma separated list of globs to filter which built-ins are included. | ||||||||||||||||||||||||||
| - `--exclude`: Comma separated list of globs to filter which built-ins are excluded. | ||||||||||||||||||||||||||
| - `--features`: Comma separated list of features from "features.txt". If not specified features are guessed based on files in the same directory. | ||||||||||||||||||||||||||
| - `--globals`: Spec files or directories defining additional global properties. Needed when generating tests for ECMA-402 or for proposals. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Run with `--help` to show all available command line arguments: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||||||
| $ python tools/property-test-generator/main.py --help | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Examples: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Generate property tests for all built-ins defined in "$ECMA262/spec.html": | ||||||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||||||
| $ python tools/property-test-generator/main.py $ECMA262/spec.html | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Generate property tests for the `Number` constructor, but not the `Number` prototype object: | ||||||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||||||
| $ python tools/property-test-generator/main.py --include=Number* --exclude=Number.prototype* $ECMA262/spec.html | ||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For better shell and environment portability:
Suggested change
|
||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Generate property tests for all built-ins defined in "$ECMA402/spec": | ||||||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||||||
| python tools/property-test-generator/main.py --global=$ECMA262/spec.html $ECMA402/spec/ | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| The `--global` argument is necessary to correctly pick up global definitions from ECMA-262. | ||||||||||||||||||||||||||
|
Comment on lines
+31
to
+36
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal consistency:
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Generate property tests for all built-ins defined in the `Temporal` proposal: | ||||||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||||||
| python tools/property-test-generator/main.py --globals=$ECMA262/spec.html --globals=$ECMA402/spec/ --features=Temporal $PROPOSALS/proposal-temporal/spec/ | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| The `--features` argument adds `features: [Temporal]` to test metadata section. | ||||||||||||||||||||||||||
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.