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

Add a test case for ENV#select_bang,keep_if

* test/ruby/test_env.rb: [Fix GH-1201]
  * Extract test code for ENV#keep_if from ENV#select_bang
  * Add a test case for ENV#select_bang,keep_if

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-01-17 05:43:40 +00:00
parent ddd40c73b6
commit f918d2b8e2
2 changed files with 12 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Sun Jan 17 14:43:01 2016 Kuniaki IGARASHI <igaiga@gmail.com>
* test/ruby/test_env.rb: [Fix GH-1201]
* Extract test code for ENV#keep_if from ENV#select_bang
* Add a test case for ENV#select_bang,keep_if
Sun Jan 17 14:42:25 2016 Kuniaki IGARASHI <igaiga@gmail.com> Sun Jan 17 14:42:25 2016 Kuniaki IGARASHI <igaiga@gmail.com>
* test/ruby/test_env.rb: [Fix GH-1201] * test/ruby/test_env.rb: [Fix GH-1201]

View file

@ -212,6 +212,10 @@ class TestEnv < Test::Unit::TestCase
ENV.each_pair {|k, v| h2[k] = v } ENV.each_pair {|k, v| h2[k] = v }
assert_equal(h1, h2) assert_equal(h1, h2)
assert_nil(ENV.select! {|k, v| IGNORE_CASE ? k.upcase != "TEST" : k != "test" })
end
def test_keep_if
h1 = {} h1 = {}
ENV.each_pair {|k, v| h1[k] = v } ENV.each_pair {|k, v| h1[k] = v }
ENV["test"] = "foo" ENV["test"] = "foo"
@ -219,6 +223,8 @@ class TestEnv < Test::Unit::TestCase
h2 = {} h2 = {}
ENV.each_pair {|k, v| h2[k] = v } ENV.each_pair {|k, v| h2[k] = v }
assert_equal(h1, h2) assert_equal(h1, h2)
assert_equal(ENV, ENV.keep_if {|k, v| IGNORE_CASE ? k.upcase != "TEST" : k != "test" })
end end
def test_values_at def test_values_at