diff options
author | TSUYUSATO Kitsune <make.just.on@gmail.com> | 2023-11-14 17:05:16 +0900 |
---|---|---|
committer | Kevin Newton <kddnewton@gmail.com> | 2023-11-14 16:22:03 -0500 |
commit | 93e9be2f69a916935ec97322a75b8516527e5b7e (patch) | |
tree | f2670d125461bd9534b6f228e95bcae241f7d89f /test/prism/errors_test.rb | |
parent | 5048c4f461bb98880bc8cacc2bbee9660afa8790 (diff) | |
download | ruby-93e9be2f69a916935ec97322a75b8516527e5b7e.tar.gz |
[ruby/prism] Check value expressions on creating a node
https://github.com/ruby/prism/commit/d60948bac3
Diffstat (limited to 'test/prism/errors_test.rb')
-rw-r--r-- | test/prism/errors_test.rb | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb index 8bc61974a2..d756c1cb0d 100644 --- a/test/prism/errors_test.rb +++ b/test/prism/errors_test.rb @@ -1740,19 +1740,33 @@ module Prism ], compare_ripper: false # Ripper does not check 'void value expression'. end - def test_void_value_expression_in_hash + def test_void_value_expression_in_unary_call source = <<~RUBY - { return => 1 } - { 1 => return } - { a: return } - { **return } + +(return) + not return RUBY message = 'Unexpected void value expression' assert_errors expression(source), source, [ [message, 2..8], - [message, 23..29], - [message, 37..43], - [message, 50..56], + [message, 14..20], + ], compare_ripper: false # Ripper does not check 'void value expression'. + end + + def test_void_value_expression_in_binary_call + source = <<~RUBY + 1 + (return) + (return) + 1 + 1 and (return) + (return) and 1 + 1 or (return) + (return) or 1 + RUBY + message = 'Unexpected void value expression' + assert_errors expression(source), source, [ + [message, 5..11], + [message, 14..20], + [message, 42..48], + [message, 71..77], ], compare_ripper: false # Ripper does not check 'void value expression'. end |