diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-03 17:36:39 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-03 17:36:39 +0000 |
commit | 9a026aec0adf6aaf10a606670ad826f7c50b5654 (patch) | |
tree | 5689a2a29827a54ee3707a2f6f1670dff615da26 | |
parent | 43ad8929dffa798953ac11e7dd4531d2d45376be (diff) |
* 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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | test/ruby/test_env.rb | 18 |
2 files changed, 22 insertions, 0 deletions
@@ -1,3 +1,7 @@ +Thu Mar 4 02:34:59 2010 Yusuke Endoh <mame@tsg.ne.jp> + + * test/ruby/test_env.rb (TestEnv#test_select_bang): add tests. + Thu Mar 4 02:29:52 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * test/ruby/test_hash.rb (TestHash#test_keep_if): fix typo. 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")) |