diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-29 05:01:04 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-29 05:01:04 +0000 |
commit | 6f97605fe308a98855f964e03a5faddde3ed5867 (patch) | |
tree | 786587cf8d34002cb7bc05ed6b3cccedde456640 /test/ruby/test_file_exhaustive.rb | |
parent | e8dc702f5e725fe6b168e1a5702a9443fbf88f4d (diff) |
merge revision(s) 49618,49640: [Backport #10858]
* win32/file.c (rb_file_expand_path_internal): do not make invalid
(or ADS) path if the path has a drive letter, the result also
should have be under it. [ruby-core:68130] [Bug #10858]
* win32/file.c (rb_file_expand_path_internal): neither the drive
of base directory nor the current drive are involved in the
result if different than the drive of path.
[ruby-core:68130] [Bug #10858]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_file_exhaustive.rb')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index bd69addef6..c0f92ec820 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -447,6 +447,7 @@ class TestFileExhaustive < Test::Unit::TestCase assert_equal(@file, File.expand_path(@file + "::$DATA")) assert_match(/\Ac:\//i, File.expand_path('c:'), '[ruby-core:31591]') assert_match(/\Ac:\//i, File.expand_path('c:foo', 'd:/bar')) + assert_match(/\Ae:\//i, File.expand_path('e:foo', 'd:/bar')) assert_match(%r'\Ac:/bar/foo\z'i, File.expand_path('c:foo', 'c:/bar')) end if DRIVE @@ -784,6 +785,12 @@ class TestFileExhaustive < Test::Unit::TestCase assert_equal("#{Dir.pwd}/a/b/c", File.expand_path(obj)) end + def test_expand_path_with_drive_letter + bug10858 = '[ruby-core:68130] [Bug #10858]' + assert_match(%r'/bar/foo\z'i, File.expand_path('z:foo', 'bar'), bug10858) + assert_equal('z:/bar/foo', File.expand_path('z:foo', '/bar'), bug10858) + end if DRIVE + def test_basename assert_equal(File.basename(@file).sub(/\.test$/, ""), File.basename(@file, ".test")) assert_equal("", s = File.basename("")) |