diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-09-14 12:01:59 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-09-14 18:32:16 +0000 |
| commit | 63d1e056650293bb77f9a5c11600013afa801bba (patch) | |
| tree | 19f19f8069d4760df47a665be6fbbe0bf6f4c171 /test | |
| parent | fb1328e4676da4dfc174ccadc57899e2eac96a63 (diff) | |
[ruby/yarp] Handle errors when operator writes on a call with a block
https://github.com/ruby/yarp/commit/93bec2c173
Diffstat (limited to 'test')
| -rw-r--r-- | test/yarp/errors_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb index 09abe3ee79..99ae840565 100644 --- a/test/yarp/errors_test.rb +++ b/test/yarp/errors_test.rb @@ -1163,6 +1163,30 @@ module YARP ] end + def test_call_with_block_and_write + source = "foo {} &&= 1" + assert_errors expression(source), source, [ + ["Unexpected write target", 0..6], + ["Unexpected operator after a call with a block", 7..10] + ] + end + + def test_call_with_block_or_write + source = "foo {} ||= 1" + assert_errors expression(source), source, [ + ["Unexpected write target", 0..6], + ["Unexpected operator after a call with a block", 7..10] + ] + end + + def test_call_with_block_operator_write + source = "foo {} += 1" + assert_errors expression(source), source, [ + ["Unexpected write target", 0..6], + ["Unexpected operator after a call with a block", 7..9] + ] + end + private def assert_errors(expected, source, errors) |
