mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Making coreutils umkdir as the default mkdir (#12007)
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> `umkdir` was added in #10785, I think it's time to replace the default one. # After Submitting Remove the old `mkdir` command and making coreutils' `umkdir` as the default
This commit is contained in:
@ -1,125 +0,0 @@
|
||||
use nu_test_support::fs::files_exist_at;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, pipeline};
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn creates_directory() {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"mkdir my_new_directory"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("my_new_directory");
|
||||
|
||||
assert!(expected.exists());
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accepts_and_creates_directories() {
|
||||
Playground::setup("mkdir_test_2", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"mkdir dir_1 dir_2 dir_3"
|
||||
);
|
||||
|
||||
assert!(files_exist_at(
|
||||
vec![Path::new("dir_1"), Path::new("dir_2"), Path::new("dir_3")],
|
||||
dirs.test()
|
||||
));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn creates_intermediary_directories() {
|
||||
Playground::setup("mkdir_test_3", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"mkdir some_folder/another/deeper_one"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("some_folder/another/deeper_one");
|
||||
|
||||
assert!(expected.exists());
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_directory_two_parents_up_using_multiple_dots() {
|
||||
Playground::setup("mkdir_test_4", |dirs, sandbox| {
|
||||
sandbox.within("foo").mkdir("bar");
|
||||
|
||||
nu!(
|
||||
cwd: dirs.test().join("foo/bar"),
|
||||
"mkdir .../boo"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("boo");
|
||||
|
||||
assert!(expected.exists());
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn print_created_paths() {
|
||||
Playground::setup("mkdir_test_2", |dirs, _| {
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
pipeline(
|
||||
"mkdir -v dir_1 dir_2 dir_3"
|
||||
));
|
||||
|
||||
assert!(files_exist_at(
|
||||
vec![Path::new("dir_1"), Path::new("dir_2"), Path::new("dir_3")],
|
||||
dirs.test()
|
||||
));
|
||||
|
||||
assert!(actual.err.contains("dir_1"));
|
||||
assert!(actual.err.contains("dir_2"));
|
||||
assert!(actual.err.contains("dir_3"));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn creates_directory_three_dots() {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"mkdir test..."
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("test...");
|
||||
|
||||
assert!(expected.exists());
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn creates_directory_four_dots() {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"mkdir test...."
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("test....");
|
||||
|
||||
assert!(expected.exists());
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn creates_directory_three_dots_quotation_marks() {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"mkdir 'test...'"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("test...");
|
||||
|
||||
assert!(expected.exists());
|
||||
})
|
||||
}
|
@ -60,7 +60,6 @@ mod ls;
|
||||
mod match_;
|
||||
mod math;
|
||||
mod merge;
|
||||
mod mkdir;
|
||||
mod mktemp;
|
||||
mod move_;
|
||||
mod mut_;
|
||||
|
@ -5,10 +5,10 @@ use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn creates_directory() {
|
||||
Playground::setup("umkdir_test_1", |dirs, _| {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"umkdir my_new_directory"
|
||||
"mkdir my_new_directory"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("my_new_directory");
|
||||
@ -19,10 +19,10 @@ fn creates_directory() {
|
||||
|
||||
#[test]
|
||||
fn accepts_and_creates_directories() {
|
||||
Playground::setup("umkdir_test_2", |dirs, _| {
|
||||
Playground::setup("mkdir_test_2", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"umkdir dir_1 dir_2 dir_3"
|
||||
"mkdir dir_1 dir_2 dir_3"
|
||||
);
|
||||
|
||||
assert!(files_exist_at(
|
||||
@ -34,10 +34,10 @@ fn accepts_and_creates_directories() {
|
||||
|
||||
#[test]
|
||||
fn creates_intermediary_directories() {
|
||||
Playground::setup("umkdir_test_3", |dirs, _| {
|
||||
Playground::setup("mkdir_test_3", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"umkdir some_folder/another/deeper_one"
|
||||
"mkdir some_folder/another/deeper_one"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("some_folder/another/deeper_one");
|
||||
@ -48,12 +48,12 @@ fn creates_intermediary_directories() {
|
||||
|
||||
#[test]
|
||||
fn create_directory_two_parents_up_using_multiple_dots() {
|
||||
Playground::setup("umkdir_test_4", |dirs, sandbox| {
|
||||
Playground::setup("mkdir_test_4", |dirs, sandbox| {
|
||||
sandbox.within("foo").mkdir("bar");
|
||||
|
||||
nu!(
|
||||
cwd: dirs.test().join("foo/bar"),
|
||||
"umkdir .../boo"
|
||||
"mkdir .../boo"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("boo");
|
||||
@ -64,10 +64,10 @@ fn create_directory_two_parents_up_using_multiple_dots() {
|
||||
|
||||
#[test]
|
||||
fn print_created_paths() {
|
||||
Playground::setup("umkdir_test_2", |dirs, _| {
|
||||
Playground::setup("mkdir_test_2", |dirs, _| {
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
pipeline("umkdir -v dir_1 dir_2 dir_3")
|
||||
pipeline("mkdir -v dir_1 dir_2 dir_3")
|
||||
);
|
||||
|
||||
assert!(files_exist_at(
|
||||
@ -83,10 +83,10 @@ fn print_created_paths() {
|
||||
|
||||
#[test]
|
||||
fn creates_directory_three_dots() {
|
||||
Playground::setup("umkdir_test_1", |dirs, _| {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"umkdir test..."
|
||||
"mkdir test..."
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("test...");
|
||||
@ -97,10 +97,10 @@ fn creates_directory_three_dots() {
|
||||
|
||||
#[test]
|
||||
fn creates_directory_four_dots() {
|
||||
Playground::setup("umkdir_test_1", |dirs, _| {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"umkdir test...."
|
||||
"mkdir test...."
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("test....");
|
||||
@ -111,10 +111,10 @@ fn creates_directory_four_dots() {
|
||||
|
||||
#[test]
|
||||
fn creates_directory_three_dots_quotation_marks() {
|
||||
Playground::setup("umkdir_test_1", |dirs, _| {
|
||||
Playground::setup("mkdir_test_1", |dirs, _| {
|
||||
nu!(
|
||||
cwd: dirs.test(),
|
||||
"umkdir 'test...'"
|
||||
"mkdir 'test...'"
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("test...");
|
||||
|
Reference in New Issue
Block a user