summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-10 16:31:18 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-10 16:31:18 +0000
commite49c2e3569ebf5a1304483efca4c92c143a3e321 (patch)
treee4286f9d2b8f682645c2367e0c2f105eb251692c /test
parent00d499992b74a91e8dc539c9076d7a8e9e078296 (diff)
merge revision(s) 51263,51264: [Backport #11352]
* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine stack before rewinding the control frame pointer and leaving the arguments outside valid region of the value stack. [ruby-core:69969] [Bug #11352] * vm.c (REWIND_CFP): keep the arguments region inside the valid value stack. [ruby-core:69969] [Bug #11352] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_literal.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index 6c1123d38e..ed5f83655c 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -192,7 +192,9 @@ class TestRubyLiteral < Test::Unit::TestCase
assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("[#{(1..1_000_000).to_a.join(", ")}]").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => x"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => #{n}"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
+ end
+ def test_big_hash_literal
bug7466 = '[ruby-dev:46658]'
h = {
0xFE042 => 0xE5CD,
@@ -327,6 +329,19 @@ class TestRubyLiteral < Test::Unit::TestCase
}
k = h.keys
assert_equal([129, 0xFE331], [k.size, k.last], bug7466)
+
+ code = [
+ "h = {",
+ (1..128).map {|i| "#{i} => 0,"},
+ (129..140).map {|i| "#{i} => [],"},
+ "}",
+ ].join
+ assert_separately([], <<-"end;")
+ GC.stress = true
+ #{code}
+ GC.stress = false
+ assert_equal(140, h.size)
+ end;
end
def test_range