36 Commits

Author SHA1 Message Date
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
legendecas
2e7cdfbe18 Fix generator clean fail on .DS_Store 2022-05-05 17:03:58 -04: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
Rick Waldron
5b54058ad7 Enable configuration of templates for generated tests. Fixes gh-1049 2020-09-25 13:16:06 -04:00
Rick Waldron
99ceda42a4 Generation: support more complex globbing. Ref gh-1049 2020-09-25 13:16:06 -04:00
Rick Waldron
95d51c4a15 Generation: don't make negative parse SyntaxError tests that have flags: [async]. Fixes gh-1229 2020-09-10 16:22:34 -04:00
Rick Waldron
8c3a208ef6 Add globbing support to test generator 2020-09-10 11:14:18 -04:00
Adrian Heine
271dad7c0a Read existing generated files with correct encoding
Otherwise we cannot parse the comments
2020-05-13 10:58:07 -04:00
Ms2ger
3ff5c0a115 Generation: Support Python 3 (#2288)
* Generation: Use Python 3-compatible imports.

* Generation: Use range() instead of xrange().

* Generation: Use list comprehensions instead of map().

* Generation: Explicitly use bytes in the Test class.

* Generation: Run unit tests on Python 3 as well.
2019-08-14 12:46:23 -04:00
Ms2ger
c4e5d69044 Tools: Update PyYAML version. (#2279)
Fixes #2278.
2019-08-12 09:49:14 -04:00
Aleksey Shvayka
a8d4eefa85 Skip hidden files in generator.py (#2183) 2019-05-29 10:58:53 -04:00
Mathias Bynens
73d9169cab Generation: fix more YAML frontmatter writer to eliminate errant newlines from yaml.dump()
This applies the fix from #1821 to the remaining frontmatter properties that consist of lists.

Ref. https://github.com/tc39/test262/pull/1821/files#r222811633.
Ref. #1817.
2018-10-17 10:51:10 -04:00
Rick Waldron
01e67df36e Generation: fix yaml frontmatter writer to eliminate errant newlines from yaml.dump() 2018-10-04 16:21:11 -04:00
jugglinmike
7b01f9799f [generation] Tolerate unicode in source files (#1411) 2018-02-09 11:27:33 -05:00
André Bargull
dd1f55a3dc Allow to specify negative frontmatter values in templates files 2017-05-04 09:29:37 -07:00
Mike Pennisi
da4e798e5b [generation] Prevent invalid transformation
In order to promote readability of the generated test material, the test
generation tool may insert whitespace if the context a given expanded
variable calls for it. Avoid inserting such whitespace within literal
values that span multiple lines.
2017-03-04 12:17:35 -05:00
Mike Pennisi
7f6e6d137d [generation] Parse and render new error format
Extend the test generation tool to emit the recently-modified format of
the "negative" meta-data. Update the effected test case files
accordingly.
2016-10-19 15:24:19 -04:00
Leo Balter
1e75730d5f Merge pull request #587 from bocoup/generation-annexb-fns
Add tests for Annex B "function in block" semantics (procedurally generated)
2016-05-31 17:45:48 -04:00
Mike Pennisi
eb1c382aa5 [generation] Preserve newlines in info tag 2016-04-26 16:13:30 -04:00
Mike Pennisi
3777273b5d [generation] Avoid generating trailing whitespace 2016-04-26 16:12:49 -04:00
Mike Pennisi
82051d8f6a [generation] Strip whitespace from generated YAML 2016-04-26 13:52:54 -04:00
jugglinmike
54fcbf7ae0 [generation] Support changing to existing files (#583)
When inspecting previously-generated files, a new `Test` instance should
be used. This avoids over-writing the in-memory representation of the
latest test, and allows previously-existing test files to be partially
updated according to subsequent changes in their respective source/case
files.
2016-04-25 12:20:23 -04:00
Mike Pennisi
613d33adbb [generation] Improve file creation heuristic
In expecting "case directories" to contain a sub-directory named
"default", the test generation tool is unable to generate tests for
features where a directory named "default" is not appropriate.

Modify the heuristic that identifies "case directories" to use a more
fundamental aspect (i.e. the existence of at least one "case" file).
2016-04-18 16:18:54 -04:00
Mike Pennisi
b0b41775e5 [generation] Expand "comments" in string literals
Extend test generation tool to recognize and expand interpolation
patterns within string literals.
2016-04-18 15:46:06 -04:00
Mike Pennisi
c5b9716144 Introduce test generation tool 2016-03-16 14:39:44 -04:00