From ee90455a447aaafe1985ba365d0357ba8f524146 Mon Sep 17 00:00:00 2001 From: luislavena Date: Sun, 10 Mar 2013 14:39:09 +0000 Subject: Expand home directory when used in dir_string * win32/file.c (rb_file_expand_path_internal): Expand home directory when used as second parameter (dir_string). [ruby-core:53168] [Bug #8034] * test/ruby/test_file_exhaustive.rb: add test to verify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_file_exhaustive.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 360a1c7cce..25cb92ea36 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -502,6 +502,18 @@ class TestFileExhaustive < Test::Unit::TestCase end end + def test_expand_path_home_dir_string + home = ENV["HOME"] + new_home = "#{DRIVE}/UserHome" + ENV["HOME"] = new_home + bug8034 = "[ruby-core:53168]" + + assert_equal File.join(new_home, "foo"), File.expand_path("foo", "~") + assert_equal File.join(new_home, "bar", "foo"), File.expand_path("foo", "~/bar") + ensure + ENV["HOME"] = home + end if DRIVE + def test_expand_path_remove_trailing_alternative_data assert_equal File.join(@rootdir, "aaa"), File.expand_path("#{@rootdir}/aaa::$DATA") assert_equal File.join(@rootdir, "aa:a"), File.expand_path("#{@rootdir}/aa:a:$DATA") -- cgit v1.2.3