mkdir can take multiple directories or multiple directory hierachies and wil create them as required.

This commit is contained in:
Andrés N. Robalino
2019-08-21 07:07:37 -05:00
parent 23ef76a86b
commit 8b79b28971
2 changed files with 60 additions and 24 deletions

View File

@ -2,7 +2,7 @@ mod helpers;
use h::{in_directory as cwd, Playground};
use helpers as h;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
#[test]
fn creates_directory() {
@ -19,11 +19,25 @@ fn creates_directory() {
}
#[test]
fn creates_intermediary_directories() {
fn accepts_and_creates_directories() {
let sandbox = Playground::setup_for("mkdir_test_2").test_dir_name();
let full_path = format!("{}/{}", Playground::root(), sandbox);
nu!(_output, cwd(&full_path), "mkdir dir_1 dir_2 dir_3");
assert!(h::files_exist_at(
vec![Path::new("dir_1"), Path::new("dir_2"), Path::new("dir_3")],
PathBuf::from(&full_path)
));
}
#[test]
fn creates_intermediary_directories() {
let sandbox = Playground::setup_for("mkdir_test_3").test_dir_name();
let full_path = format!("{}/{}", Playground::root(), sandbox);
nu!(
_output,
cwd(&full_path),