aboutsummaryrefslogtreecommitdiffstats
path: root/test/prism/errors_test.rb
diff options
context:
space:
mode:
authorTSUYUSATO Kitsune <make.just.on@gmail.com>2023-11-15 23:05:08 +0900
committergit <svn-admin@ruby-lang.org>2023-11-22 14:53:28 +0000
commit8794836bf256c4bad51111b085f9d07e463432a0 (patch)
tree04e05461f87cf359ac877f03d111a31b99e04601 /test/prism/errors_test.rb
parent2aefbbaab9c9a86fb70f30bca86ed73411679d6d (diff)
downloadruby-8794836bf256c4bad51111b085f9d07e463432a0.tar.gz
[ruby/prism] Fix associativity of binary range with begin-less range
Fix https://github.com/ruby/prism/pull/1828 https://github.com/ruby/prism/commit/22c0640e48
Diffstat (limited to 'test/prism/errors_test.rb')
-rw-r--r--test/prism/errors_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb
index bc3f3ebee9..5572a3254f 100644
--- a/test/prism/errors_test.rb
+++ b/test/prism/errors_test.rb
@@ -1770,6 +1770,21 @@ module Prism
]
end
+ def test_binary_range_with_left_unary_range
+ source = <<~RUBY
+ ..1..
+ ...1..
+ RUBY
+ message1 = 'Expected a newline or semicolon after the statement'
+ message2 = 'Cannot parse the expression'
+ assert_errors expression(source), source, [
+ [message1, 3..3],
+ [message2, 3..3],
+ [message1, 10..10],
+ [message2, 10..10],
+ ]
+ end
+
private
def assert_errors(expected, source, errors, compare_ripper: RUBY_ENGINE == "ruby")