mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 19:37:45 +02:00
Remove old nushell/merge engine-q
This commit is contained in:
@ -3,11 +3,7 @@ use std::path::Path;
|
||||
use nu_test_support::fs::Stub::EmptyFile;
|
||||
use nu_test_support::playground::Playground;
|
||||
|
||||
<<<<<<< HEAD
|
||||
use nu_path::{canonicalize, canonicalize_with};
|
||||
=======
|
||||
use nu_path::canonicalize_with;
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
|
||||
#[test]
|
||||
fn canonicalize_path() {
|
||||
@ -17,12 +13,8 @@ fn canonicalize_path() {
|
||||
let mut spam = dirs.test().clone();
|
||||
spam.push("spam.txt");
|
||||
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize(spam).expect("Failed to canonicalize");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = canonicalize_with(spam, cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
|
||||
assert!(actual.ends_with("spam.txt"));
|
||||
});
|
||||
@ -36,13 +28,9 @@ fn canonicalize_unicode_path() {
|
||||
let mut spam = dirs.test().clone();
|
||||
spam.push("🚒.txt");
|
||||
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize(spam).expect("Failed to canonicalize");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
|
||||
let actual = canonicalize_with(spam, cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
|
||||
assert!(actual.ends_with("🚒.txt"));
|
||||
});
|
||||
@ -108,13 +96,9 @@ fn canonicalize_absolute_path_relative_to() {
|
||||
|
||||
#[test]
|
||||
fn canonicalize_dot() {
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize(".").expect("Failed to canonicalize");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
|
||||
let actual = canonicalize_with(".", cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
let expected = std::env::current_dir().expect("Could not get current directory");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
@ -122,14 +106,10 @@ fn canonicalize_dot() {
|
||||
|
||||
#[test]
|
||||
fn canonicalize_many_dots() {
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize("././/.//////./././//.///").expect("Failed to canonicalize");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
|
||||
let actual =
|
||||
canonicalize_with("././/.//////./././//.///", cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
let expected = std::env::current_dir().expect("Could not get current directory");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
@ -164,13 +144,8 @@ fn canonicalize_path_with_many_dots_relative_to() {
|
||||
|
||||
#[test]
|
||||
fn canonicalize_double_dot() {
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize("..").expect("Failed to canonicalize");
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = canonicalize_with("..", &cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
let expected = cwd
|
||||
.parent()
|
||||
.expect("Could not get parent of current directory");
|
||||
@ -210,13 +185,8 @@ fn canonicalize_path_with_many_double_dots_relative_to() {
|
||||
|
||||
#[test]
|
||||
fn canonicalize_ndots() {
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize("...").expect("Failed to canonicalize");
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = canonicalize_with("...", &cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
let expected = cwd
|
||||
.parent()
|
||||
.expect("Could not get parent of current directory")
|
||||
@ -332,12 +302,8 @@ fn canonicalize_unicode_path_with_way_too_many_dots_relative_to_unicode_path_wit
|
||||
fn canonicalize_tilde() {
|
||||
let tilde_path = "~";
|
||||
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize(tilde_path).expect("Failed to canonicalize");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = canonicalize_with(tilde_path, cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
|
||||
assert!(actual.is_absolute());
|
||||
assert!(!actual.starts_with("~"));
|
||||
@ -364,12 +330,8 @@ fn canonicalize_symlink() {
|
||||
let mut symlink_path = dirs.test().clone();
|
||||
symlink_path.push("link_to_spam.txt");
|
||||
|
||||
<<<<<<< HEAD
|
||||
let actual = canonicalize(symlink_path).expect("Failed to canonicalize");
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = canonicalize_with(symlink_path, cwd).expect("Failed to canonicalize");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
let mut expected = dirs.test().clone();
|
||||
expected.push("spam.txt");
|
||||
|
||||
@ -448,12 +410,8 @@ fn canonicalize_nested_symlink_within_symlink_dir_relative_to() {
|
||||
fn canonicalize_should_fail() {
|
||||
let path = Path::new("/foo/bar/baz"); // hopefully, this path does not exist
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(canonicalize(path).is_err());
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
assert!(canonicalize_with(path, cwd).is_err());
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2,29 +2,20 @@ use std::path::PathBuf;
|
||||
|
||||
use nu_test_support::playground::Playground;
|
||||
|
||||
<<<<<<< HEAD
|
||||
use nu_path::{expand_path, expand_path_with};
|
||||
|
||||
=======
|
||||
use nu_path::expand_path_with;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn expand_path_with_and_without_relative() {
|
||||
let relative_to = "/foo/bar";
|
||||
let path = "../..";
|
||||
let full_path = "/foo/bar/../..";
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert_eq!(expand_path(full_path), expand_path_with(path, relative_to),);
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
assert_eq!(
|
||||
expand_path_with(full_path, cwd),
|
||||
expand_path_with(path, relative_to),
|
||||
);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -35,20 +26,13 @@ fn expand_path_with_relative() {
|
||||
assert_eq!(PathBuf::from("/"), expand_path_with(path, relative_to),);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
#[cfg(not(windows))]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn expand_path_no_change() {
|
||||
let path = "/foo/bar";
|
||||
|
||||
<<<<<<< HEAD
|
||||
let actual = expand_path(&path);
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = expand_path_with(&path, cwd);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
|
||||
assert_eq!(actual, PathBuf::from(path));
|
||||
}
|
||||
@ -59,12 +43,8 @@ fn expand_unicode_path_no_change() {
|
||||
let mut spam = dirs.test().clone();
|
||||
spam.push("🚒.txt");
|
||||
|
||||
<<<<<<< HEAD
|
||||
let actual = expand_path(spam);
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = expand_path_with(spam, cwd);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
let mut expected = dirs.test().clone();
|
||||
expected.push("🚒.txt");
|
||||
|
||||
@ -123,25 +103,6 @@ fn expand_absolute_path_relative_to() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
<<<<<<< HEAD
|
||||
fn expand_path_dot() {
|
||||
let actual = expand_path(".");
|
||||
let expected = PathBuf::from(".");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn expand_path_many_dots() {
|
||||
let actual = expand_path("././/.//////./././//.///");
|
||||
let expected = PathBuf::from("././././././.");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
=======
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
fn expand_path_with_dot_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, _| {
|
||||
let actual = expand_path_with("./spam.txt", dirs.test());
|
||||
@ -153,33 +114,6 @@ fn expand_path_with_dot_relative_to() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
<<<<<<< HEAD
|
||||
fn expand_path_double_dot() {
|
||||
let actual = expand_path("..");
|
||||
let expected = PathBuf::from("..");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn expand_path_dot_double_dot() {
|
||||
let actual = expand_path("./..");
|
||||
let expected = PathBuf::from("./..");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn expand_path_double_dot_dot() {
|
||||
let actual = expand_path("../.");
|
||||
let expected = PathBuf::from("..");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
=======
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
fn expand_path_with_many_dots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, _| {
|
||||
let actual = expand_path_with("././/.//////./././//.////spam.txt", dirs.test());
|
||||
@ -213,26 +147,6 @@ fn expand_path_with_many_double_dots_relative_to() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
<<<<<<< HEAD
|
||||
fn expand_path_ndots() {
|
||||
let actual = expand_path("...");
|
||||
let mut expected = PathBuf::from("..");
|
||||
expected.push("..");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn expand_normal_path_ndots() {
|
||||
let actual = expand_path("foo/bar/baz/...");
|
||||
let expected = PathBuf::from("foo");
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
=======
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
fn expand_path_with_3_ndots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, _| {
|
||||
let actual = expand_path_with("foo/bar/.../spam.txt", dirs.test());
|
||||
@ -314,12 +228,8 @@ fn expand_unicode_path_with_way_too_many_dots_relative_to_unicode_path_with_spac
|
||||
fn expand_path_tilde() {
|
||||
let tilde_path = "~";
|
||||
|
||||
<<<<<<< HEAD
|
||||
let actual = expand_path(tilde_path);
|
||||
=======
|
||||
let cwd = std::env::current_dir().expect("Could not get current directory");
|
||||
let actual = expand_path_with(tilde_path, cwd);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
|
||||
assert!(actual.is_absolute());
|
||||
assert!(!actual.starts_with("~"));
|
||||
|
2
tests/path/mod.rs
Normal file
2
tests/path/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
mod canonicalize;
|
||||
mod expand_path;
|
Reference in New Issue
Block a user