diff options
Diffstat (limited to 'bootstraptest/test_literal.rb')
-rw-r--r-- | bootstraptest/test_literal.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bootstraptest/test_literal.rb b/bootstraptest/test_literal.rb index ab028e2c1e..19200c1ee7 100644 --- a/bootstraptest/test_literal.rb +++ b/bootstraptest/test_literal.rb @@ -200,3 +200,25 @@ assert_equal 'ok', %q{ assert_equal 'ok', %q{ "#{}o""#{}k""#{}" }, '[ruby-core:25284]' + +assert_equal 'ok', %q{ # long array literal + x = nil + eval "a = [#{(1..10_000).map{'x'}.join(", ")}]" + :ok +} + +assert_equal 'ok', %q{ # long array literal (optimized) + eval "a = [#{(1..10_000).to_a.join(", ")}]" + :ok +} + +assert_equal 'ok', %q{ # long hash literal + x = nil + eval "a = {#{(1..10_000).map{|n| "#{n} => x"}.join(', ')}}" + :ok +} + +assert_equal 'ok', %q{ # long hash literal (optimized) + eval "a = {#{(1..10_000).map{|n| "#{n} => #{n}"}.join(', ')}}" + :ok +} |