diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-20 15:06:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-20 15:06:56 +0000 |
commit | a302bf03adb7e2b8a81f977703d98be6898c8fc2 (patch) | |
tree | f33ad9fcd4569f51d7f0b85fefb751597211438d /spec/ruby/core/env/to_h_spec.rb | |
parent | 69ac3060bd331d165068b7cd150dbd526dcf3034 (diff) | |
download | ruby-a302bf03adb7e2b8a81f977703d98be6898c8fc2.tar.gz |
Enumerable#to_h with block and so on
[Feature #15143]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/env/to_h_spec.rb')
-rw-r--r-- | spec/ruby/core/env/to_h_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/env/to_h_spec.rb b/spec/ruby/core/env/to_h_spec.rb index f7f4314335..f6c796b4d6 100644 --- a/spec/ruby/core/env/to_h_spec.rb +++ b/spec/ruby/core/env/to_h_spec.rb @@ -3,4 +3,17 @@ require_relative 'shared/to_hash' describe "ENV.to_hash" do it_behaves_like :env_to_hash, :to_h + + ruby_version_is "2.6" do + it "converts [key, value] pairs returned by the block to a hash" do + orig = ENV.to_hash + begin + ENV.replace "a" => "b", "c" => "d" + i = 0 + ENV.to_h {|k, v| [k.to_sym, v.upcase]}.should == {a:"B", c:"D"} + ensure + ENV.replace orig + end + end + end end |