summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-10-04 13:57:14 -0400
committerKevin Newton <[email protected]>2024-10-04 15:04:26 -0400
commit30038656aa3a4931abefd99b8166c26599d168fd (patch)
tree84ad3eb5e1d838f0a269508058071fd64f7f633c /test/ruby
parentf77517f473c38e3fcef72c23de977a44da881caf (diff)
Fix intermediate array off-by-one error
Co-authored-by: Adam Hess <[email protected]>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11800
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index afe39f9aef..92c1304e9b 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -768,6 +768,9 @@ module Prism
assert_prism_eval("a = [1,2]; [0, *a, 3, 4, *5..6, 7, 8, *9..11]")
assert_prism_eval("[[*1..2], 3, *4..5]")
+ elements = Array.new(64) { ":foo" }
+ assert_prism_eval("[#{elements.join(", ")}, bar: 1, baz: 2]")
+
# Test keyword splat inside of array
assert_prism_eval("[**{x: 'hello'}]")
@@ -2628,7 +2631,7 @@ end
def compare_eval(source, raw:, location:)
source = raw ? source : "class Prism::TestCompilePrism\n#{source}\nend"
- ruby_eval = RubyVM::InstructionSequence.compile(source).eval
+ ruby_eval = RubyVM::InstructionSequence.compile_parsey(source).eval
prism_eval = RubyVM::InstructionSequence.compile_prism(source).eval
if ruby_eval.is_a? Proc