aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_env.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-03 17:36:39 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-03 17:36:39 +0000
commit9a026aec0adf6aaf10a606670ad826f7c50b5654 (patch)
tree5689a2a29827a54ee3707a2f6f1670dff615da26 /test/ruby/test_env.rb
parent43ad8929dffa798953ac11e7dd4531d2d45376be (diff)
downloadruby-9a026aec0adf6aaf10a606670ad826f7c50b5654.tar.gz
* test/ruby/test_env.rb (TestEnv#test_select_bang): add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_env.rb')
-rw-r--r--test/ruby/test_env.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 94f978e71c..17c7666e07 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -175,6 +175,24 @@ class TestEnv < Test::Unit::TestCase
assert_equal(h1, h2)
end
+ def test_select_bang
+ h1 = {}
+ ENV.each_pair {|k, v| h1[k] = v }
+ ENV["test"] = "foo"
+ ENV.select! {|k, v| IGNORE_CASE ? k.upcase != "TEST" : k != "test" }
+ h2 = {}
+ ENV.each_pair {|k, v| h2[k] = v }
+ assert_equal(h1, h2)
+
+ h1 = {}
+ ENV.each_pair {|k, v| h1[k] = v }
+ ENV["test"] = "foo"
+ ENV.keep_if {|k, v| IGNORE_CASE ? k.upcase != "TEST" : k != "test" }
+ h2 = {}
+ ENV.each_pair {|k, v| h2[k] = v }
+ assert_equal(h1, h2)
+ end
+
def test_values_at
ENV["test"] = "foo"
assert_equal(["foo", "foo"], ENV.values_at("test", "test"))