Make mkdir wrapper use mkdir_p to create intermediate directories
This commit is contained in:
parent
7a63a75360
commit
7fc241765e
@ -88,7 +88,7 @@ module FileUtils
|
||||
|
||||
# A version of mkdir that also changes to that folder in a block.
|
||||
def mkdir(name, &_block)
|
||||
old_mkdir(name)
|
||||
mkdir_p(name)
|
||||
if block_given?
|
||||
chdir name do
|
||||
yield
|
||||
|
||||
@ -257,4 +257,11 @@ class PathnameInstallTests < Homebrew::TestCase
|
||||
@dst.install_symlink "foo" => "bar"
|
||||
assert_equal Pathname.new("foo"), (@dst/"bar").readlink
|
||||
end
|
||||
|
||||
def test_mkdir_creates_intermediate_directories
|
||||
mkdir @dst/"foo/bar/baz" do
|
||||
assert_predicate @dst/"foo/bar/baz", :exist?, "foo/bar/baz was not created"
|
||||
assert_predicate @dst/"foo/bar/baz", :directory?, "foo/bar/baz was not a directory structure"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user