try and catch for the test of setenv(3).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-05-29 16:49:14 +00:00
Родитель 818cb970b9
Коммит e524bb986a
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -124,13 +124,17 @@ class TestEnv < Test::Unit::TestCase
assert_equal(nil, ENV["test"])
assert_raise(ArgumentError) { ENV["foo\0bar"] = "test" }
assert_raise(ArgumentError) { ENV["test"] = "foo\0bar" }
if /netbsd|openbsd/ =~ RUBY_PLATFORM
begin
# setenv(3) allowed the name includes '=',
# but POSIX.1-2001 says it should fail with EINVAL.
# see also http://togetter.com/li/22380
ENV["foo=bar"] = "test"
assert_equal("test", ENV["foo=bar"])
assert_equal("test", ENV["foo"])
else
assert_raise(Errno::EINVAL) { ENV["foo=bar"] = "test" }
rescue Errno::EINVAL
end
ENV[PATH_ENV] = "/tmp/".taint
assert_equal("/tmp/", ENV[PATH_ENV])
end