13 Commits

Author SHA1 Message Date
Aurèle
05fbae4993 Fix Regex Character Class Escape Tests
For each character class escape (\d, \D, \s, \S, \w, \W), check
positive cases (the escape matches all characters it's supposed to
match) and negative cases (the escape doesn't match any of the
characters it should not match).  Each of these checks is also done in
Unicode mode and with the v flag.

This uses regenerate.js from the unicode-property-escapes-tests
repo to generate strings that contain exactly the characters that
are supposed to be matched or not matched for each escape.

Comparison is done with regex test instead of regex replace to
optimize the tests.

This is part of my work at the SYSTEMF lab at EPFL.

Avoid modifying the regenerate library object prototype.
2025-03-13 11:58:44 -07:00
Philip Chimento
9a0aa4c719 regexp-generator: Fix indentation
Our config files specify two-space indents for JS files. These scripts
were probably written before that was a thing. Update the indentation of
the script and the generated tests all in one go.
2024-11-11 17:26:56 -08:00
Philip Chimento
7e1f1e749d regexp-generator: Update ECMA-262 quote in header
While we're touching this we may as well update the quote from ECMA-262 to
match what it currently says.
2024-11-11 17:26:56 -08:00
Philip Chimento
3aec6e3729 regexp-generator: Make package private
As per the package.json docs, these are optional if the package is not
being published.
2024-11-11 17:26:56 -08:00
Philip Chimento
031ed02ad1 regexp-generator: Update front matter
Add the `generated` flag, and update the link to the generator script.
2024-11-11 17:26:56 -08:00
Philip Chimento
54e02bdd56 regexp-generator: Remove dead code
These are unused parameters and variables, and all have no effect on the
output.
2024-11-11 17:26:56 -08:00
Philip Chimento
07ddc3b41b regexp-generator: Implement downstream changes
The optimizations from commit e558b29b were never incorporated into the
upstream test generator. This does so now.

As far as I can tell, the changes to the Unicode ranges are purely
cosmetic. Some are formatted as 6-digit hex numbers instead of 4-digit.
Others move the low-surrogates range 0xDC00-0xDCFF to the beginning of the
array, but the union of the ranges is still the same.
2024-11-11 17:26:56 -08:00
Philip Chimento
879326855b regexp-generator: Use ES modules, update dependencies
This code hasn't been touched in a while, so it's probably good to bring
in the newest versions of the dependencies. We can easily tell if there
was any incompatible effect on the output.

The latest version of filenamify requires using ES modules. We also have
to adapt to a breaking change in regexpu-core (see
https://github.com/mathiasbynens/regexpu-core/pull/49).

Also convert the dependencies to devDependencies, since this tool is not
necessary for executing test262.
2024-11-11 17:26:56 -08:00
Philip Chimento
754ecf1ad3 regexp-generator: Expand README
Add some minimal instructions for regenerating the tests.
2024-11-11 17:26:56 -08:00
Philip Chimento
a65ca0e6a3 regexp-generator: Add 'npm run clean' script 2024-11-11 17:26:56 -08:00
Philip Chimento
e8342c37d5 regexp-generator: Ensure folder exists before generating 2024-11-11 17:26:56 -08:00
Philip Chimento
c8c800c845 regexp-generator: Update output path
Instead of an output/ folder, output the tests directly into the folder
where they live.
2024-11-11 17:26:56 -08:00
Philip Chimento
99be4228ef Add files from bocoup/test262-regexp-generator
Old upstream: https://github.com/bocoup/test262-regexp-generator
2024-11-11 17:26:56 -08:00