diff options
Diffstat (limited to 'test/ruby/test_env.rb')
-rw-r--r-- | test/ruby/test_env.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index 6a44cf17dd..c1109cb2ef 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -287,6 +287,17 @@ class TestEnv < Test::Unit::TestCase assert_equal({"foo"=>"bar", "baz"=>"qux"}, ENV.slice("foo", "baz")) end + def test_except + ENV.clear + ENV["foo"] = "bar" + ENV["baz"] = "qux" + ENV["bar"] = "rab" + assert_equal({"bar"=>"rab", "baz"=>"qux", "foo"=>"bar"}, ENV.except()) + assert_equal({"bar"=>"rab", "baz"=>"qux", "foo"=>"bar"}, ENV.except("")) + assert_equal({"bar"=>"rab", "baz"=>"qux", "foo"=>"bar"}, ENV.except("unknown")) + assert_equal({"bar"=>"rab"}, ENV.except("foo", "baz")) + end + def test_clear ENV.clear assert_equal(0, ENV.size) |