summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_env.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 699f7db084..2f4923fbd9 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -281,6 +281,17 @@ class TestEnv < Test::Unit::TestCase
end
end
+ def test_slice
+ ENV.clear
+ ENV["foo"] = "bar"
+ ENV["baz"] = "qux"
+ ENV["bar"] = "rab"
+ assert_equal({}, ENV.slice())
+ assert_equal({}, ENV.slice(""))
+ assert_equal({}, ENV.slice("unknown"))
+ assert_equal({"foo"=>"bar", "baz"=>"qux"}, ENV.slice("foo", "baz"))
+ end
+
def test_clear
ENV.clear
assert_equal(0, ENV.size)