summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Valentine-House <[email protected]>2024-01-17 16:44:58 +0000
committerMatt Valentine-House <[email protected]>2024-01-18 20:03:27 +0000
commit8a3e7f08b85a9a21077c420b6fa76f56899e90ee (patch)
treec9a3cee3926d0177ea6ee64d2b19ff6cbccfb974 /test
parent686b1655a008f194d4daccf2d423d94c30633206 (diff)
[PRISM] Fix case splat with no predicate
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_compile_prism.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index f1274fccf5..0765a946a5 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -857,6 +857,17 @@ module Prism
end
RUBY
+ # Test splat in when
+ assert_prism_eval(<<~RUBY)
+ ary = [1, 2]
+ case 1
+ when :foo, *ary
+ :ok
+ else
+ :ng
+ end
+ RUBY
+
# Test case without predicate
assert_prism_eval(<<~RUBY)
case
@@ -866,6 +877,16 @@ module Prism
:ok
end
RUBY
+
+ # test splat with no predicate
+ assert_prism_eval(<<~RUBY)
+ case
+ when *[true]
+ :ok
+ else
+ :ng
+ end
+ RUBY
end
def test_ElseNode