diff options
author | TSUYUSATO Kitsune <make.just.on@gmail.com> | 2023-12-04 13:00:41 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-04 14:00:23 +0000 |
commit | 2a65d8370702b3f2a5db21b65f21ccef6f0b503b (patch) | |
tree | bebeadb72c43f171a70b7d745a722e23037a3d36 /test | |
parent | 85bc80a51be0ceedcc57e7b6b779e6f8f885859e (diff) | |
download | ruby-2a65d8370702b3f2a5db21b65f21ccef6f0b503b.tar.gz |
[ruby/prism] Check "void value expression" for array literals
Fix https://github.com/ruby/prism/pull/1978
https://github.com/ruby/prism/commit/194c997d0a
Diffstat (limited to 'test')
-rw-r--r-- | test/prism/errors_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb index a7683aa430..df41da493a 100644 --- a/test/prism/errors_test.rb +++ b/test/prism/errors_test.rb @@ -1660,6 +1660,28 @@ module Prism ], compare_ripper: false # Ripper does not check 'void value expression'. end + def test_void_value_expression_in_array + source = <<~RUBY + [return] + [1, return] + [ return => 1 ] + [ 1 => return ] + [ a: return ] + [ *return ] + [ **return ] + RUBY + message = 'unexpected void value expression' + assert_errors expression(source), source, [ + [message, 1..7], + [message, 13..19], + [message, 23..29], + [message, 44..50], + [message, 58..64], + [message, 70..76], + [message, 83..89], + ], compare_ripper: false # Ripper does not check 'void value expression'. + end + def test_void_value_expression_in_hash source = <<~RUBY { return => 1 } |