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 /test/prism/errors | |
| 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 'test/prism/errors')
| -rw-r--r-- | test/prism/errors/3.3-3.3/circular_parameters.txt | 12 | ||||
| -rw-r--r-- | test/prism/errors/3.3-3.4/leading_logical.txt | 34 | ||||
| -rw-r--r-- | test/prism/errors/3.3-3.4/private_endless_method.txt | 3 | ||||
| -rw-r--r-- | test/prism/errors/3.4/block_args_in_array_assignment.txt (renamed from test/prism/errors/block_args_in_array_assignment.txt) | 0 | ||||
| -rw-r--r-- | test/prism/errors/3.4/dont_allow_return_inside_sclass_body.txt (renamed from test/prism/errors/dont_allow_return_inside_sclass_body.txt) | 0 | ||||
| -rw-r--r-- | test/prism/errors/3.4/it_with_ordinary_parameter.txt (renamed from test/prism/errors/it_with_ordinary_parameter.txt) | 0 | ||||
| -rw-r--r-- | test/prism/errors/3.4/keyword_args_in_array_assignment.txt (renamed from test/prism/errors/keyword_args_in_array_assignment.txt) | 0 |
7 files changed, 49 insertions, 0 deletions
diff --git a/test/prism/errors/3.3-3.3/circular_parameters.txt b/test/prism/errors/3.3-3.3/circular_parameters.txt new file mode 100644 index 0000000000..ef9642b075 --- /dev/null +++ b/test/prism/errors/3.3-3.3/circular_parameters.txt @@ -0,0 +1,12 @@ +def foo(bar = bar) = 42 + ^~~ circular argument reference - bar + +def foo(bar: bar) = 42 + ^~~ circular argument reference - bar + +proc { |foo = foo| } + ^~~ circular argument reference - foo + +proc { |foo: foo| } + ^~~ circular argument reference - foo + diff --git a/test/prism/errors/3.3-3.4/leading_logical.txt b/test/prism/errors/3.3-3.4/leading_logical.txt new file mode 100644 index 0000000000..2a702e281d --- /dev/null +++ b/test/prism/errors/3.3-3.4/leading_logical.txt @@ -0,0 +1,34 @@ +1 +&& 2 +^~ unexpected '&&', ignoring it +&& 3 +^~ unexpected '&&', ignoring it + +1 +|| 2 +^ unexpected '|', ignoring it + ^ unexpected '|', ignoring it +|| 3 +^ unexpected '|', ignoring it + ^ unexpected '|', ignoring it + +1 +and 2 +^~~ unexpected 'and', ignoring it +and 3 +^~~ unexpected 'and', ignoring it + +1 +or 2 +^~ unexpected 'or', ignoring it +or 3 +^~ unexpected 'or', ignoring it + +1 +and foo +^~~ unexpected 'and', ignoring it + +2 +or foo +^~ unexpected 'or', ignoring it + diff --git a/test/prism/errors/3.3-3.4/private_endless_method.txt b/test/prism/errors/3.3-3.4/private_endless_method.txt new file mode 100644 index 0000000000..8aae5e0cd3 --- /dev/null +++ b/test/prism/errors/3.3-3.4/private_endless_method.txt @@ -0,0 +1,3 @@ +private def foo = puts "Hello" + ^ unexpected string literal, expecting end-of-input + diff --git a/test/prism/errors/block_args_in_array_assignment.txt b/test/prism/errors/3.4/block_args_in_array_assignment.txt index 71dca8452b..71dca8452b 100644 --- a/test/prism/errors/block_args_in_array_assignment.txt +++ b/test/prism/errors/3.4/block_args_in_array_assignment.txt diff --git a/test/prism/errors/dont_allow_return_inside_sclass_body.txt b/test/prism/errors/3.4/dont_allow_return_inside_sclass_body.txt index c29fe01728..c29fe01728 100644 --- a/test/prism/errors/dont_allow_return_inside_sclass_body.txt +++ b/test/prism/errors/3.4/dont_allow_return_inside_sclass_body.txt diff --git a/test/prism/errors/it_with_ordinary_parameter.txt b/test/prism/errors/3.4/it_with_ordinary_parameter.txt index ff9c4276ca..ff9c4276ca 100644 --- a/test/prism/errors/it_with_ordinary_parameter.txt +++ b/test/prism/errors/3.4/it_with_ordinary_parameter.txt diff --git a/test/prism/errors/keyword_args_in_array_assignment.txt b/test/prism/errors/3.4/keyword_args_in_array_assignment.txt index e379ec0ef4..e379ec0ef4 100644 --- a/test/prism/errors/keyword_args_in_array_assignment.txt +++ b/test/prism/errors/3.4/keyword_args_in_array_assignment.txt |
