forked from extern/nushell
Remove old nushell/merge engine-q
This commit is contained in:
@ -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("~"));
|
||||
|
Reference in New Issue
Block a user