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

* 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
This commit is contained in:
mame 2010-03-03 17:36:39 +00:00
parent 43ad8929df
commit 9a026aec0a
2 changed files with 22 additions and 0 deletions

View file

@ -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.

View file

@ -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"))