summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-21 03:47:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-21 03:47:36 +0000
commit2098b5aea5e197f23a40d95933306bf09e782aa3 (patch)
tree2ec55f62558b9365cf0ea5119068928e51a2d9c1 /test
parent97c3018a5d95005a5b49086c0522a5ba0dbed39f (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_2@49671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index c629461efd..0c16a01453 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'))
when /darwin/
["\u{feff}", *"\u{2000}"..."\u{2100}"].each do |c|
@@ -795,6 +796,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(""))