summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-08 09:51:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-08 09:51:34 +0000
commitf0355ae7078c8539aaec5991411802c6fd055533 (patch)
tree20100680dbad4c3ccf9247106f4614134ea0a595 /test/ruby
parent65bbd0884c3ec76ca9bb1dfa54184957ac2dff79 (diff)
file.c: home dir fall back
* file.c (rb_home_dir_of): return the default home path if the user name is the current user name, on platforms where struct pwd is not supported. a temporary measure against [Bug #12226]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_dir.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index 2685bea2a4..b188f4da60 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -295,6 +295,10 @@ class TestDir < Test::Unit::TestCase
assert_nothing_raised(ArgumentError) {
assert_equal(@nodir, Dir.home)
assert_equal(@nodir, Dir.home(""))
+ if user = ENV["USER"]
+ ENV["HOME"] = env_home
+ assert_equal(File.expand_path(env_home), Dir.home(user))
+ end
}
%W[no:such:user \u{7559 5b88}:\u{756a}].each do |user|
assert_raise_with_message(ArgumentError, /#{user}/) {Dir.home(user)}