Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tools/property-test-generator/README.md
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- `--features`: Comma separated list of features from "features.txt". If not specified features are guessed based on files in the same directory.
- `--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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For better shell and environment portability:

Suggested change
$ python tools/property-test-generator/main.py --include=Number* --exclude=Number.prototype* $ECMA262/spec.html
$ python tools/property-test-generator/main.py --include='Number*' --exclude='Number.prototype*' $ECMA262/spec.html

```

- 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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 "$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.
- Generate property tests for all built-ins defined in "$ECMA402/spec":
```sh
python tools/property-test-generator/main.py --globals=$ECMA262/spec.html $ECMA402/spec/
```
The `--globals` argument is necessary to correctly pick up global definitions from ECMA-262.


- 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.
Loading