275 Commits

Author SHA1 Message Date
Richard Gibson
cf4c281a38 Improve license linting
* Bump max year to $now + 1.
* Emit a more specific error for year range where a single year is expected.
2025-04-04 12:47:48 -04:00
Richard Gibson
2f937a61fd Update features/includes test linting to report all unused/unrecognized values
(rather than just the first)
2025-04-04 12:47:48 -04:00
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
André Bargull
c3cbc32745 Checks features are consistent in parsetestrecord 2024-12-18 16:11:18 +01:00
André Bargull
ada06362dc Add linter for parseTestRecord 2024-12-17 17:52:36 +01:00
André Bargull
9e915f9b3c Update parseTestRecord and monkeyYaml to handle new tests
Changes:
- Allow zero indent for lists
- Handle list with zero elements
- Handle public domain license block
2024-12-17 17:52:36 +01:00
Ms2ger
d0bda4d26f Allow public domain dedications 2024-12-09 13:35:08 -08:00
Ms2ger
3468e6aa77 Support excluding harness files from the unused includes check 2024-12-09 13:35:08 -08: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
Philip Chimento
b292eb95c3 Remove ci_build.sh
After the previous commit, it doesn't do much. Just write its contents
directly in the workflow step.
2024-11-11 16:48:38 -08:00
Philip Chimento
c73968aaaf Migrate test generation workflow to GitHub Actions
This runs faster and allows for future improvements.

Similar to the linter workflow, we remove the Circle-CI-specific stuff
from the file in tools/scripts/, and into .github/workflows/.

We use another external action (tj-actions/verify-changed-files) to check
that generating the tests didn't create any new changes. This is basically
a companion action to the tj-actions/changed-files used in the linter job.
2024-11-11 16:48:38 -08:00
Philip Chimento
0df1565532 Remove ci_lint.sh
After the previous commit, it doesn't do much, only passes the linting
exceptions file on the command line. Instead, make the lint.exceptions
file the default for that argument (if it exists), and remove the shell
script.
2024-11-11 16:48:38 -08:00
Philip Chimento
7fc86bca6a Migrate linter workflow to GitHub Actions
This runs faster and allows for future improvements.

I'm following a general principle of keeping code that isn't portable
between CI providers inside the config file for the CI provider. So in
this case we remove the Circle-CI-specific stuff from the file in
tools/scripts/, and into .github/workflows/. We use an external action
(tj-actions/changed-files) to gather the list of files to lint.
2024-11-11 16:48:38 -08:00
Philip Chimento
6b38428da1 Remove obsolete deploy scripts
We do not use these anymore. Generated tests are included in PRs and not
deployed separately. The deploy key encryption relies on TravisCI which we
don't use anymore, anyway.
2024-11-11 16:48:38 -08:00
Philip Chimento
7f3a536c9f generation: Move list-iteration to end of short-circuited condition
Suggested by Richard in code review.
2024-10-16 12:02:49 -07:00
Philip Chimento
faca8af32d generation: DRY list(OrderedDict) idiom
A named function is also more self-documenting. Thanks to Richard for the
suggestion.
2024-10-16 12:02:49 -07:00
Philip Chimento
8e9141e69d generation: Fix bytes/str error
This was probably left over from supporting Python 2 in the scripts.
2024-10-16 12:02:49 -07:00
Philip Chimento
65ff60c209 generation: Remove invalid escape in re.sub pattern
Recent Python gives a warning about the \s escape in a string pattern
passed to re.sub(). Apparently this is not supported. Instead, pass a
width of ∞ to yaml.dump() to avoid adding the line breaks in the first
place that the regexp was removing.
2024-10-16 12:02:49 -07:00
Peter Hoddie
d6155b6ef2 add verifyPrimordialProperty 2024-10-11 12:45:30 -07:00
André Bargull
b218cf6dec Replace "imp" module with "importlib" in parseTestRecord
The "imp" module is deprecated in Python 3.4 and will be removed in
Python 3.12. Use it only if the current Python version is too old to use
the "importlib" module.
2023-11-15 09:15:47 -08:00
Liviu Rau
be929de3ec Allow linter to use alternate features.txt file 2023-10-16 12:37:31 -07:00
Ms2ger
715dd1073b Only lint js and json files
CheckFileName is the only one that could arguably be valid for other files, but it doesn't seem worth the complexity to run it.
2023-10-06 13:45:37 +02:00
André Bargull
a8bd958193
Don't require Inflect for linting files (#3839) 2023-08-28 16:22:19 +02:00
Philip Chimento
a58ae41ea7 linter: Fix parsing features.txt
Previously, split() would split on whitespace, then the if-condition would
remove `#` - interpreting every word in every comment in the file as a
potential valid feature flag. We want splitlines() here.

Partial-line comments were inadvertently "supported" before, because of
this bug. Instead, support them explicitly by chopping off a `#`
character, anything after it, and any whitespace immediately preceding it.
2023-03-06 17:31:20 +01:00
Philip Chimento
6e1b737357 linter: Use same Python interpreter when executing script in subprocess
If a specific Python interpreter is used (e.g. by invoking the script with
"/path/to/python run.py") then we should use the same Python interpreter
to execute scripts in subprocesses, not the one from the environment.

The path to the running Python interpreter is given by sys.executable.
2023-03-06 17:31:20 +01:00
legendecas
2e7cdfbe18 Fix generator clean fail on .DS_Store 2022-05-05 17:03:58 -04:00
Csaba Osztrogonác
00f682e746 tools: enforce restriction on YAML negative key
The phase field must precede the type field for negative tests
to have a consistent style and be able to parse easier.
Related to the goal of https://github.com/tc39/test262/issues/1997

Added this check to the linting script and updated tests accordingly.
2022-01-10 13:50:38 -05:00
Csaba Osztrogonác
bd1acb51a4 tools: enforce restriction on YAML includes key
Includes key should use flow notation to be able parsed easier
as suggested in https://github.com/tc39/test262/issues/1997

Added this check to the linting script and updated tests accordingly.
2022-01-05 17:27:58 -05:00
Mike Pennisi
c4e54648c0 tools: enforce restriction on YAML
Some consumers have reported difficulty parsing an uncommon YAML
construction [1] [2] [3]. Extend the linter to help ensure that
construction is not used in future contributions.

[1] https://github.com/tc39/test262/issues/1997
[2] https://github.com/tc39/test262/pull/2505
[3] https://github.com/tc39/test262/issues/3171
2021-09-07 17:41:36 -04:00
Rick Waldron
304edd2296
chore: migrate $ERROR -> throw new Test262Error in tools/lint/test/fixtures/harness/propertyHelper.js (#3124) 2021-07-29 12:34:53 -07:00
Richard Gibson
1483cdee1a Skip parsing test files that don't need regeneration 2021-07-28 13:23:51 -04:00
Richard Gibson
e07f577a9c Default to not regenerate test files that are newer than their case and template 2021-07-28 13:23:51 -04:00
Richard Gibson
1925fa1a3b Update Test to lazily parse generated content 2021-07-28 13:23:51 -04:00
Richard Gibson
172d75bacd Rename a variable for clarity 2021-07-28 13:23:51 -04:00
Richard Gibson
52ff4171ab Improve code clarity 2021-07-28 12:43:25 -04:00
Richard Gibson
20e06a147f Improve "Procedurally-generated tests" documentation 2021-07-28 12:43:25 -04:00
Richard Gibson
bf0297c0a4 Fix typo 2021-07-19 13:28:31 -04:00
Richard Gibson
a7fed497c6 Make it possible to express test case values as a sequence of code points 2021-07-16 09:49:17 -04:00
Richard Gibson
d15066ec39
Cleanup generation code (#3041)
* Simplify find_cases

* Improve help text

* Improve YAML-capturing regex

* Use built-in dedenting

* Fix use of built-in dedenting

* Fix use of built-in dedenting for Python 3
2021-07-16 09:39:57 -04:00