1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Test separately to get rid of risk to modify unrelated hash

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-12-20 06:59:27 +00:00
parent ec7b1e475b
commit fe8475d7df

View file

@ -283,11 +283,13 @@ class TestRubyLiteral < Test::Unit::TestCase
assert_equal "literal", h["string"] assert_equal "literal", h["string"]
end end
def test_hash_literal_frozen
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;
def frozen_hash_literal_arg def frozen_hash_literal_arg
{0=>1,1=>4,2=>17} {0=>1,1=>4,2=>17}
end end
def test_hash_literal_frozen
assert_not_include frozen_hash_literal_arg, 3 assert_not_include frozen_hash_literal_arg, 3
assert_raise(FrozenError) do assert_raise(FrozenError) do
ObjectSpace.each_object(Hash) do |a| ObjectSpace.each_object(Hash) do |a|
@ -297,6 +299,7 @@ class TestRubyLiteral < Test::Unit::TestCase
end end
end end
assert_not_include frozen_hash_literal_arg, 3 assert_not_include frozen_hash_literal_arg, 3
end;
end end
def test_big_array_and_hash_literal def test_big_array_and_hash_literal