diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-08 09:51:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-08 09:51:34 +0000 |
commit | f0355ae7078c8539aaec5991411802c6fd055533 (patch) | |
tree | 20100680dbad4c3ccf9247106f4614134ea0a595 /test/ruby | |
parent | 65bbd0884c3ec76ca9bb1dfa54184957ac2dff79 (diff) | |
download | ruby-f0355ae7078c8539aaec5991411802c6fd055533.tar.gz |
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.rb | 4 |
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)} |