From e524bb986a849ce4271285cccfd7fff286952353 Mon Sep 17 00:00:00 2001 From: naruse Date: Sun, 29 May 2011 16:49:14 +0000 Subject: 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 --- test/ruby/test_env.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index b987a4bac0..9166f4df6c 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 -- cgit v1.2.3