summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-17 05:43:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-17 05:43:40 +0000
commitf918d2b8e2f2736f57bd2ff01167702757e0a75b (patch)
tree93fa38f6e7116d928153ab9c4894de0712f5d0f4 /test
parentddd40c73b622fb1854a6b4fee39c41d154328fbf (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_env.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 9fe85fb190..7224d572ec 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -212,6 +212,10 @@ class TestEnv < Test::Unit::TestCase
ENV.each_pair {|k, v| h2[k] = v }
assert_equal(h1, h2)
+ assert_nil(ENV.select! {|k, v| IGNORE_CASE ? k.upcase != "TEST" : k != "test" })
+ end
+
+ def test_keep_if
h1 = {}
ENV.each_pair {|k, v| h1[k] = v }
ENV["test"] = "foo"
@@ -219,6 +223,8 @@ class TestEnv < Test::Unit::TestCase
h2 = {}
ENV.each_pair {|k, v| h2[k] = v }
assert_equal(h1, h2)
+
+ assert_equal(ENV, ENV.keep_if {|k, v| IGNORE_CASE ? k.upcase != "TEST" : k != "test" })
end
def test_values_at