summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-09 14:56:38 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-09 14:56:38 +0000
commit0deee2020f7e455a901ffca4d28655eb386df390 (patch)
tree857b639daeaa1c7ca00ba99f7aec7bade1673723 /test
parente006dc674231eae818072b0da7fb5f1b68e160eb (diff)
merge revision(s) 57640: [Backport #13214]
fileutils.rb: do not make root * lib/fileutils.rb (FileUtils#mkdir_p): no need to make root directory which should be exist and cannot be made with mkdir recent Cygwin can make a directory contains a colon. [Bug #13214] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@58631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/fileutils/test_fileutils.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 4d790a74bc..0534b1b08e 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -905,6 +905,24 @@ class TestFileUtils < Test::Unit::TestCase
mkdir_p '/'
end
+ if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
+ def test_mkdir_p_root
+ if /cygwin/ =~ RUBY_PLATFORM
+ tmpdir = `cygpath -ma .`.chomp
+ else
+ tmpdir = Dir.pwd
+ end
+ skip "No drive letter" unless /\A[a-z]:/i =~ tmpdir
+ drive = "./#{$&}"
+ assert_file_not_exist drive
+ mkdir_p "#{tmpdir}/none/dir"
+ assert_directory "none/dir"
+ assert_file_not_exist drive
+ ensure
+ Dir.rmdir(drive) if drive and File.directory?(drive)
+ end
+ end
+
def test_mkdir_p_file_perm
mkdir_p 'tmp/tmp/tmp', :mode => 07777
assert_directory 'tmp/tmp/tmp'