aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/hash
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-06-27 21:02:36 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-06-27 21:02:36 +0200
commitd80e44deec77678fe2d72f94c17b2409b3e794d5 (patch)
tree612bf2313550e0982dda452f48492cc069e1c21a /spec/ruby/core/hash
parentc940397116c5aef76b1c0d05561c11d43ef596a7 (diff)
downloadruby-d80e44deec77678fe2d72f94c17b2409b3e794d5.tar.gz
Update to ruby/spec@8d74d49
Diffstat (limited to 'spec/ruby/core/hash')
-rw-r--r--spec/ruby/core/hash/merge_spec.rb7
-rw-r--r--spec/ruby/core/hash/shared/update.rb7
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/ruby/core/hash/merge_spec.rb b/spec/ruby/core/hash/merge_spec.rb
index 54abcb816d..77e5c42071 100644
--- a/spec/ruby/core/hash/merge_spec.rb
+++ b/spec/ruby/core/hash/merge_spec.rb
@@ -99,11 +99,4 @@ end
describe "Hash#merge!" do
it_behaves_like :hash_update, :merge!
-
- it "does not raise an exception if changing the value of an existing key during iteration" do
- hash = {1 => 2, 3 => 4, 5 => 6}
- hash2 = {1 => :foo, 3 => :bar}
- hash.each { hash.merge!(hash2) }
- hash.should == {1 => :foo, 3 => :bar, 5 => 6}
- end
end
diff --git a/spec/ruby/core/hash/shared/update.rb b/spec/ruby/core/hash/shared/update.rb
index 250c5ab440..e808add5c0 100644
--- a/spec/ruby/core/hash/shared/update.rb
+++ b/spec/ruby/core/hash/shared/update.rb
@@ -57,6 +57,13 @@ describe :hash_update, shared: true do
end.should raise_error(frozen_error_class)
end
+ it "does not raise an exception if changing the value of an existing key during iteration" do
+ hash = {1 => 2, 3 => 4, 5 => 6}
+ hash2 = {1 => :foo, 3 => :bar}
+ hash.each { hash.send(@method, hash2) }
+ hash.should == {1 => :foo, 3 => :bar, 5 => 6}
+ end
+
ruby_version_is "2.6" do
it "accepts multiple hashes" do
result = { a: 1 }.send(@method, { b: 2 }, { c: 3 }, { d: 4 })