summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJemma Issroff <[email protected]>2023-11-30 12:57:49 -0500
committerJemma Issroff <[email protected]>2023-12-01 13:07:59 -0500
commitd6584a02011120c15b520fa08e5e5f0132b686de (patch)
tree99cf2433f6c7b43afe428c26ab5bac36bdab8e15 /test
parentef466ac931dcb37f98fc89eba526c2593e1cddb0 (diff)
[PRISM] Fix behavior of BlockParameters with only one parameter
This commit sets the ambiguous param flag if there is only one parameter on a block node. It also fixes a small bug with a trailing comma on params.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_compile_prism.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index c56792de0d..2786e2052d 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -847,6 +847,15 @@ module Prism
assert_prism_eval("[].tap { _1 }")
assert_prism_eval("[].each { |a,| }")
+
+ assert_prism_eval("[[]].map { |a| a }")
+ assert_prism_eval("[[]].map { |a| a }")
+ assert_prism_eval("[[]].map { |a, &block| a }")
+ assert_prism_eval("[[]].map { |a, &block| a }")
+ assert_prism_eval("[{}].map { |a,| }")
+ assert_prism_eval("[[]].map { |a,b=1| a }")
+ assert_prism_eval("[{}].map { |a,| }")
+ assert_prism_eval("[{}].map { |a| a }")
end
def test_ClassNode