Fix create_dir_all("")
Add a test for `""` and `"."`.
This commit is contained in:
parent
bcae6a3734
commit
b5d590b3f0
@ -1775,6 +1775,10 @@ impl DirBuilder {
|
||||
}
|
||||
|
||||
fn create_dir_all(&self, path: &Path) -> io::Result<()> {
|
||||
if path == Path::new("") {
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
match self.inner.mkdir(path) {
|
||||
Ok(()) => return Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
|
||||
@ -2302,6 +2306,16 @@ mod tests {
|
||||
check!(fs::create_dir_all(&Path::new("/")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recursive_mkdir_dot() {
|
||||
check!(fs::create_dir_all(&Path::new(".")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recursive_mkdir_empty() {
|
||||
check!(fs::create_dir_all(&Path::new("")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recursive_rmdir() {
|
||||
let tmpdir = tmpdir();
|
||||
|
Loading…
x
Reference in New Issue
Block a user