From f0355ae7078c8539aaec5991411802c6fd055533 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 8 May 2016 09:51:34 +0000 Subject: 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 --- test/ruby/test_dir.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') 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)} -- cgit v1.2.3