diff options
| author | Earlopain <14981592+Earlopain@users.noreply.github.com> | 2025-10-17 16:19:56 +0200 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-10-22 14:50:11 +0000 |
| commit | 6047eada20d39bbe80976c31277ec7916118f78a (patch) | |
| tree | 0c2d25b98d2cc9180ac89d5b2065796860deea14 /prism | |
| parent | 66c12bd5194396fab66338a87ca8f2d89f1d66d0 (diff) | |
[ruby/prism] Make error and snapshot tests multi-version aware
This one has been on my mind for a while now.
Currently, there are only tests against the latest syntax version.
This changes the snapshot structure as follows:
* Snapshots at their current location are tested against all syntax versions
* Snapshots inside a version folder like "3.3" are tested against all versions starting from that version
* Snapshots inside a version folder like "3.3-4.2" are tested against all versions in the given range.
This makes sure that as new syntax is added, older versions still work as expected.
I also added a few tests for now valid syntax that should be invalid in older versions (and the other way around as well)
These tests run really fast. So even though it does 3x the work for these, I am still able to run the whole test suite in just 11 seconds.
https://github.com/ruby/prism/commit/5191b1aa68
Diffstat (limited to 'prism')
| -rw-r--r-- | prism/prism.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/prism/prism.c b/prism/prism.c index 0ebcae62f9..95e7d09050 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -15764,7 +15764,7 @@ parse_return(pm_parser_t *parser, pm_node_t *node) { break; } } - if (in_sclass) { + if (in_sclass && parser->version >= PM_OPTIONS_VERSION_CRUBY_3_4) { pm_parser_err_node(parser, node, PM_ERR_RETURN_INVALID); } } |
