summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 16:49:14 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 16:49:14 +0000
commite524bb986a849ce4271285cccfd7fff286952353 (patch)
tree025712aedaf3bb9df8d4e1633caac07b6ee0683d
parent818cb970b9083b2386ad47ba092b0cb8d2df0ba4 (diff)
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
-rw-r--r--test/ruby/test_env.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index b987a4bac0a..9166f4df6cd 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -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