summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--test/ruby/test_env.rb18
2 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 324c380fbb8..f30ac055333 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 94f978e71c5..17c7666e072 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"))