mirror of
https://github.com/nushell/nushell.git
synced 2025-08-15 11:53:16 +02:00
Avoid taking unnecessary ownership of intermediates (#12740)
# Description Judiciously try to avoid allocations/clone by changing the signature of functions - **Don't pass str by value unnecessarily if only read** - **Don't require a vec in `Sandbox::with_files`** - **Remove unnecessary string clone** - **Fixup unnecessary borrow** - **Use `&str` in shape color instead** - **Vec -> Slice** - **Elide string clone** - **Elide `Path` clone** - **Take &str to elide clone in tests** # User-Facing Changes None # Tests + Formatting This touches many tests purely in changing from owned to borrowed/static data
This commit is contained in:
committed by
GitHub
parent
e6f473695c
commit
406df7f208
@ -7,7 +7,7 @@ use pretty_assertions::assert_eq;
|
||||
fn module_private_import_decl() {
|
||||
Playground::setup("module_private_import_decl", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
use spam.nu foo-helper
|
||||
@ -15,7 +15,7 @@ fn module_private_import_decl() {
|
||||
export def foo [] { foo-helper }
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
def get-foo [] { "foo" }
|
||||
@ -35,7 +35,7 @@ fn module_private_import_decl() {
|
||||
fn module_private_import_alias() {
|
||||
Playground::setup("module_private_import_alias", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
use spam.nu foo-helper
|
||||
@ -43,7 +43,7 @@ fn module_private_import_alias() {
|
||||
export def foo [] { foo-helper }
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
export alias foo-helper = echo "foo"
|
||||
@ -62,13 +62,13 @@ fn module_private_import_alias() {
|
||||
fn module_private_import_decl_not_public() {
|
||||
Playground::setup("module_private_import_decl_not_public", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
use spam.nu foo-helper
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
def get-foo [] { "foo" }
|
||||
@ -88,13 +88,13 @@ fn module_private_import_decl_not_public() {
|
||||
fn module_public_import_decl() {
|
||||
Playground::setup("module_public_import_decl", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
export use spam.nu foo
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
def foo-helper [] { "foo" }
|
||||
@ -114,13 +114,13 @@ fn module_public_import_decl() {
|
||||
fn module_public_import_alias() {
|
||||
Playground::setup("module_public_import_alias", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
export use spam.nu foo
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
export alias foo = echo "foo"
|
||||
@ -139,25 +139,25 @@ fn module_public_import_alias() {
|
||||
fn module_nested_imports() {
|
||||
Playground::setup("module_nested_imports", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
export use spam.nu [ foo bar ]
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
"
|
||||
export use spam2.nu [ foo bar ]
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam2.nu",
|
||||
"
|
||||
export use spam3.nu [ foo bar ]
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam3.nu",
|
||||
r#"
|
||||
export def foo [] { "foo" }
|
||||
@ -183,25 +183,25 @@ fn module_nested_imports_in_dirs() {
|
||||
.mkdir("spam")
|
||||
.mkdir("spam/spam2")
|
||||
.mkdir("spam/spam3")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
export use spam/spam.nu [ foo bar ]
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam/spam.nu",
|
||||
"
|
||||
export use spam2/spam2.nu [ foo bar ]
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam/spam2/spam2.nu",
|
||||
"
|
||||
export use ../spam3/spam3.nu [ foo bar ]
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam/spam3/spam3.nu",
|
||||
r#"
|
||||
export def foo [] { "foo" }
|
||||
@ -224,13 +224,13 @@ fn module_nested_imports_in_dirs() {
|
||||
fn module_public_import_decl_prefixed() {
|
||||
Playground::setup("module_public_import_decl", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
export use spam.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
def foo-helper [] { "foo" }
|
||||
@ -253,26 +253,26 @@ fn module_nested_imports_in_dirs_prefixed() {
|
||||
.mkdir("spam")
|
||||
.mkdir("spam/spam2")
|
||||
.mkdir("spam/spam3")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
r#"
|
||||
export use spam/spam.nu [ "spam2 foo" "spam2 spam3 bar" ]
|
||||
"#,
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam/spam.nu",
|
||||
"
|
||||
export use spam2/spam2.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam/spam2/spam2.nu",
|
||||
"
|
||||
export use ../spam3/spam3.nu
|
||||
export use ../spam3/spam3.nu foo
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam/spam3/spam3.nu",
|
||||
r#"
|
||||
export def foo [] { "foo" }
|
||||
@ -295,7 +295,7 @@ fn module_nested_imports_in_dirs_prefixed() {
|
||||
fn module_import_env_1() {
|
||||
Playground::setup("module_import_env_1", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
export-env { source-env spam.nu }
|
||||
@ -303,7 +303,7 @@ fn module_import_env_1() {
|
||||
export def foo [] { $env.FOO_HELPER }
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
export-env { $env.FOO_HELPER = "foo" }
|
||||
@ -322,13 +322,13 @@ fn module_import_env_1() {
|
||||
fn module_import_env_2() {
|
||||
Playground::setup("module_import_env_2", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
export-env { source-env spam.nu }
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
export-env { $env.FOO = "foo" }
|
||||
@ -346,7 +346,7 @@ fn module_import_env_2() {
|
||||
#[test]
|
||||
fn module_cyclical_imports_0() {
|
||||
Playground::setup("module_cyclical_imports_0", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
"
|
||||
use eggs.nu
|
||||
@ -364,7 +364,7 @@ fn module_cyclical_imports_0() {
|
||||
#[test]
|
||||
fn module_cyclical_imports_1() {
|
||||
Playground::setup("module_cyclical_imports_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
"
|
||||
use spam.nu
|
||||
@ -383,13 +383,13 @@ fn module_cyclical_imports_1() {
|
||||
fn module_cyclical_imports_2() {
|
||||
Playground::setup("module_cyclical_imports_2", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
"
|
||||
use eggs.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"eggs.nu",
|
||||
"
|
||||
use spam.nu
|
||||
@ -408,19 +408,19 @@ fn module_cyclical_imports_2() {
|
||||
fn module_cyclical_imports_3() {
|
||||
Playground::setup("module_cyclical_imports_3", |dirs, sandbox| {
|
||||
sandbox
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
"
|
||||
use eggs.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"eggs.nu",
|
||||
"
|
||||
use bacon.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"bacon.nu",
|
||||
"
|
||||
use spam.nu
|
||||
@ -438,7 +438,7 @@ fn module_cyclical_imports_3() {
|
||||
#[test]
|
||||
fn module_import_const_file() {
|
||||
Playground::setup("module_import_const_file", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
export def foo [] { "foo" }
|
||||
@ -456,7 +456,7 @@ fn module_import_const_file() {
|
||||
#[test]
|
||||
fn module_import_const_module_name() {
|
||||
Playground::setup("module_import_const_file", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
export def foo [] { "foo" }
|
||||
|
@ -873,7 +873,7 @@ fn overlay_use_do_cd() {
|
||||
Playground::setup("overlay_use_do_cd", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("test1/test2")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"test1/test2/spam.nu",
|
||||
"
|
||||
export-env { cd test1/test2 }
|
||||
@ -896,7 +896,7 @@ fn overlay_use_do_cd_file_relative() {
|
||||
Playground::setup("overlay_use_do_cd_file_relative", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("test1/test2")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"test1/test2/spam.nu",
|
||||
"
|
||||
export-env { cd ($env.FILE_PWD | path join '..') }
|
||||
@ -919,7 +919,7 @@ fn overlay_use_dont_cd_overlay() {
|
||||
Playground::setup("overlay_use_dont_cd_overlay", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("test1/test2")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"test1/test2/spam.nu",
|
||||
"
|
||||
export-env {
|
||||
|
@ -93,7 +93,7 @@ fn parse_file_relative_to_parsed_file_simple() {
|
||||
sandbox
|
||||
.mkdir("lol")
|
||||
.mkdir("lol/lol")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"lol/lol/lol.nu",
|
||||
"
|
||||
use ../lol_shell.nu
|
||||
@ -101,7 +101,7 @@ fn parse_file_relative_to_parsed_file_simple() {
|
||||
$env.LOL = (lol_shell ls)
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"lol/lol_shell.nu",
|
||||
r#"
|
||||
export def ls [] { "lol" }
|
||||
@ -123,7 +123,7 @@ fn parse_file_relative_to_parsed_file_simple() {
|
||||
#[test]
|
||||
fn predecl_signature_single_inp_out_type() {
|
||||
Playground::setup("predecl_signature_single_inp_out_type", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam1.nu",
|
||||
"
|
||||
def main [] { foo }
|
||||
@ -143,7 +143,7 @@ fn predecl_signature_multiple_inp_out_types() {
|
||||
Playground::setup(
|
||||
"predecl_signature_multiple_inp_out_types",
|
||||
|dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"spam2.nu",
|
||||
"
|
||||
def main [] { foo }
|
||||
@ -166,7 +166,7 @@ fn parse_file_relative_to_parsed_file() {
|
||||
sandbox
|
||||
.mkdir("lol")
|
||||
.mkdir("lol/lol")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"lol/lol/lol.nu",
|
||||
"
|
||||
source-env ../../foo.nu
|
||||
@ -176,13 +176,13 @@ fn parse_file_relative_to_parsed_file() {
|
||||
$env.LOL = $'($env.FOO) (lol_shell ls) (ls)'
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"lol/lol_shell.nu",
|
||||
r#"
|
||||
export def ls [] { "lol" }
|
||||
"#,
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"foo.nu",
|
||||
"
|
||||
$env.FOO = 'foo'
|
||||
@ -206,19 +206,19 @@ fn parse_file_relative_to_parsed_file_dont_use_cwd_1() {
|
||||
Playground::setup("relative_files", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("lol")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"lol/lol.nu",
|
||||
"
|
||||
source-env foo.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"lol/foo.nu",
|
||||
"
|
||||
$env.FOO = 'good'
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"foo.nu",
|
||||
"
|
||||
$env.FOO = 'bad'
|
||||
@ -242,13 +242,13 @@ fn parse_file_relative_to_parsed_file_dont_use_cwd_2() {
|
||||
Playground::setup("relative_files", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("lol")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"lol/lol.nu",
|
||||
"
|
||||
source-env foo.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"foo.nu",
|
||||
"
|
||||
$env.FOO = 'bad'
|
||||
|
@ -8,7 +8,7 @@ use std::path::Path;
|
||||
#[test]
|
||||
fn canonicalize_path() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let mut spam = dirs.test().to_owned();
|
||||
spam.push("spam.txt");
|
||||
@ -23,7 +23,7 @@ fn canonicalize_path() {
|
||||
#[test]
|
||||
fn canonicalize_unicode_path() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("🚒.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("🚒.txt")]);
|
||||
|
||||
let mut spam = dirs.test().to_owned();
|
||||
spam.push("🚒.txt");
|
||||
@ -45,7 +45,7 @@ fn canonicalize_non_utf8_path() {
|
||||
#[test]
|
||||
fn canonicalize_path_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual = canonicalize_with("spam.txt", dirs.test()).expect("Failed to canonicalize");
|
||||
let mut expected = dirs.test().to_owned();
|
||||
@ -59,7 +59,7 @@ fn canonicalize_path_relative_to() {
|
||||
fn canonicalize_unicode_path_relative_to_unicode_path_with_spaces() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("e-$ èрт🚒♞中片-j");
|
||||
sandbox.with_files(vec![EmptyFile("e-$ èрт🚒♞中片-j/🚒.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("e-$ èрт🚒♞中片-j/🚒.txt")]);
|
||||
|
||||
let mut relative_to = dirs.test().to_owned();
|
||||
relative_to.push("e-$ èрт🚒♞中片-j");
|
||||
@ -81,7 +81,7 @@ fn canonicalize_non_utf8_path_relative_to_non_utf8_path_with_spaces() {
|
||||
#[test]
|
||||
fn canonicalize_absolute_path_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let mut absolute_path = dirs.test().to_owned();
|
||||
absolute_path.push("spam.txt");
|
||||
@ -116,7 +116,7 @@ fn canonicalize_many_dots() {
|
||||
#[test]
|
||||
fn canonicalize_path_with_dot_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual = canonicalize_with("./spam.txt", dirs.test()).expect("Failed to canonicalize");
|
||||
let mut expected = dirs.test().to_owned();
|
||||
@ -129,7 +129,7 @@ fn canonicalize_path_with_dot_relative_to() {
|
||||
#[test]
|
||||
fn canonicalize_path_with_many_dots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual = canonicalize_with("././/.//////./././//.////spam.txt", dirs.test())
|
||||
.expect("Failed to canonicalize");
|
||||
@ -155,7 +155,7 @@ fn canonicalize_double_dot() {
|
||||
fn canonicalize_path_with_double_dot_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo");
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual =
|
||||
canonicalize_with("foo/../spam.txt", dirs.test()).expect("Failed to canonicalize");
|
||||
@ -170,7 +170,7 @@ fn canonicalize_path_with_double_dot_relative_to() {
|
||||
fn canonicalize_path_with_many_double_dots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/bar/baz");
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual = canonicalize_with("foo/bar/baz/../../../spam.txt", dirs.test())
|
||||
.expect("Failed to canonicalize");
|
||||
@ -205,7 +205,7 @@ fn canonicalize_ndots2() {
|
||||
fn canonicalize_path_with_3_ndots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/bar");
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual =
|
||||
canonicalize_with("foo/bar/.../spam.txt", dirs.test()).expect("Failed to canonicalize");
|
||||
@ -220,7 +220,7 @@ fn canonicalize_path_with_3_ndots_relative_to() {
|
||||
fn canonicalize_path_with_many_3_ndots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/bar/baz/eggs/sausage/bacon");
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual = canonicalize_with(
|
||||
"foo/bar/baz/eggs/sausage/bacon/.../.../.../spam.txt",
|
||||
@ -238,7 +238,7 @@ fn canonicalize_path_with_many_3_ndots_relative_to() {
|
||||
fn canonicalize_path_with_4_ndots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/bar/baz");
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual = canonicalize_with("foo/bar/baz/..../spam.txt", dirs.test())
|
||||
.expect("Failed to canonicalize");
|
||||
@ -253,7 +253,7 @@ fn canonicalize_path_with_4_ndots_relative_to() {
|
||||
fn canonicalize_path_with_many_4_ndots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/bar/baz/eggs/sausage/bacon");
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let actual = canonicalize_with(
|
||||
"foo/bar/baz/eggs/sausage/bacon/..../..../spam.txt",
|
||||
@ -271,7 +271,7 @@ fn canonicalize_path_with_many_4_ndots_relative_to() {
|
||||
fn canonicalize_path_with_way_too_many_dots_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/bar/baz/eggs/sausage/bacon/vikings");
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
|
||||
let mut relative_to = dirs.test().to_owned();
|
||||
relative_to.push("foo/bar/baz/eggs/sausage/bacon/vikings");
|
||||
@ -289,7 +289,7 @@ fn canonicalize_path_with_way_too_many_dots_relative_to() {
|
||||
fn canonicalize_unicode_path_with_way_too_many_dots_relative_to_unicode_path_with_spaces() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/áčěéí +šř=é/baz/eggs/e-$ èрт🚒♞中片-j/bacon/öäöä öäöä");
|
||||
sandbox.with_files(vec![EmptyFile("🚒.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("🚒.txt")]);
|
||||
|
||||
let mut relative_to = dirs.test().to_owned();
|
||||
relative_to.push("foo/áčěéí +šř=é/baz/eggs/e-$ èрт🚒♞中片-j/bacon/öäöä öäöä");
|
||||
@ -329,7 +329,7 @@ fn canonicalize_tilde_relative_to() {
|
||||
#[test]
|
||||
fn canonicalize_symlink() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
sandbox.symlink("spam.txt", "link_to_spam.txt");
|
||||
|
||||
let mut symlink_path = dirs.test().to_owned();
|
||||
@ -348,7 +348,7 @@ fn canonicalize_symlink() {
|
||||
#[test]
|
||||
fn canonicalize_symlink_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
sandbox.symlink("spam.txt", "link_to_spam.txt");
|
||||
|
||||
let actual =
|
||||
@ -379,7 +379,7 @@ fn canonicalize_symlink_loop_relative_to_should_fail() {
|
||||
#[test]
|
||||
fn canonicalize_nested_symlink_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("spam.txt")]);
|
||||
sandbox.symlink("spam.txt", "link_to_spam.txt");
|
||||
sandbox.symlink("link_to_spam.txt", "link_to_link_to_spam.txt");
|
||||
|
||||
@ -397,7 +397,7 @@ fn canonicalize_nested_symlink_relative_to() {
|
||||
fn canonicalize_nested_symlink_within_symlink_dir_relative_to() {
|
||||
Playground::setup("nu_path_test_1", |dirs, sandbox| {
|
||||
sandbox.mkdir("foo/bar/baz");
|
||||
sandbox.with_files(vec![EmptyFile("foo/bar/baz/spam.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("foo/bar/baz/spam.txt")]);
|
||||
sandbox.symlink("foo/bar/baz/spam.txt", "foo/bar/link_to_spam.txt");
|
||||
sandbox.symlink("foo/bar/link_to_spam.txt", "foo/link_to_link_to_spam.txt");
|
||||
sandbox.symlink("foo", "link_to_foo");
|
||||
|
@ -26,7 +26,7 @@ fn chooses_highest_increment_if_given_more_than_one() {
|
||||
#[test]
|
||||
fn by_one_with_field_passed() {
|
||||
Playground::setup("plugin_inc_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"sample.toml",
|
||||
r#"
|
||||
[package]
|
||||
@ -47,7 +47,7 @@ fn by_one_with_field_passed() {
|
||||
#[test]
|
||||
fn by_one_with_no_field_passed() {
|
||||
Playground::setup("plugin_inc_test_2", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"sample.toml",
|
||||
r#"
|
||||
[package]
|
||||
@ -68,7 +68,7 @@ fn by_one_with_no_field_passed() {
|
||||
#[test]
|
||||
fn semversion_major_inc() {
|
||||
Playground::setup("plugin_inc_test_3", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"sample.toml",
|
||||
r#"
|
||||
[package]
|
||||
@ -89,7 +89,7 @@ fn semversion_major_inc() {
|
||||
#[test]
|
||||
fn semversion_minor_inc() {
|
||||
Playground::setup("plugin_inc_test_4", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"sample.toml",
|
||||
r#"
|
||||
[package]
|
||||
@ -110,7 +110,7 @@ fn semversion_minor_inc() {
|
||||
#[test]
|
||||
fn semversion_patch_inc() {
|
||||
Playground::setup("plugin_inc_test_5", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"sample.toml",
|
||||
r#"
|
||||
[package]
|
||||
@ -131,7 +131,7 @@ fn semversion_patch_inc() {
|
||||
#[test]
|
||||
fn semversion_without_passing_field() {
|
||||
Playground::setup("plugin_inc_test_6", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"sample.toml",
|
||||
r#"
|
||||
[package]
|
||||
|
@ -6,7 +6,7 @@ use pretty_assertions::assert_eq;
|
||||
#[test]
|
||||
fn infers_types() {
|
||||
Playground::setup("filter_from_ics_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"calendar.ics",
|
||||
r#"
|
||||
BEGIN:VCALENDAR
|
||||
@ -58,7 +58,7 @@ fn infers_types() {
|
||||
#[test]
|
||||
fn from_ics_text_to_table() {
|
||||
Playground::setup("filter_from_ics_test_2", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"calendar.txt",
|
||||
r#"
|
||||
BEGIN:VCALENDAR
|
||||
@ -102,7 +102,7 @@ fn from_ics_text_to_table() {
|
||||
#[test]
|
||||
fn from_ics_text_with_linebreak_to_table() {
|
||||
Playground::setup("filter_from_ics_test_3", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"calendar.txt",
|
||||
r#"BEGIN:VCALENDAR
|
||||
BEGIN:VEVENT
|
||||
|
@ -33,7 +33,7 @@ fn parses_utf16_ini() {
|
||||
#[test]
|
||||
fn read_ini_with_missing_session() {
|
||||
Playground::setup("from ini with missiong session", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"some_missing.ini",
|
||||
r#"
|
||||
min-width=450
|
||||
|
@ -6,7 +6,7 @@ use pretty_assertions::assert_eq;
|
||||
#[test]
|
||||
fn infers_types() {
|
||||
Playground::setup("filter_from_vcf_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"contacts.vcf",
|
||||
r"
|
||||
BEGIN:VCARD
|
||||
@ -46,7 +46,7 @@ fn infers_types() {
|
||||
#[test]
|
||||
fn from_vcf_text_to_table() {
|
||||
Playground::setup("filter_from_vcf_test_2", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"contacts.txt",
|
||||
r"
|
||||
BEGIN:VCARD
|
||||
@ -86,7 +86,7 @@ fn from_vcf_text_to_table() {
|
||||
#[test]
|
||||
fn from_vcf_text_with_linebreak_to_table() {
|
||||
Playground::setup("filter_from_vcf_test_3", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"contacts.txt",
|
||||
r"BEGIN:VCARD
|
||||
VERSION:3.0
|
||||
|
@ -136,7 +136,7 @@ fn plugin_add_to_custom_path() {
|
||||
fn plugin_rm_then_restart_nu() {
|
||||
let example_plugin_path = example_plugin_path();
|
||||
Playground::setup("plugin rm from custom path", |dirs, playground| {
|
||||
playground.with_files(vec![
|
||||
playground.with_files(&[
|
||||
Stub::FileWithContent("config.nu", ""),
|
||||
Stub::FileWithContent("env.nu", ""),
|
||||
]);
|
||||
@ -318,7 +318,7 @@ fn plugin_rm_using_filename() {
|
||||
fn warning_on_invalid_plugin_item() {
|
||||
let example_plugin_path = example_plugin_path();
|
||||
Playground::setup("warning on invalid plugin item", |dirs, playground| {
|
||||
playground.with_files(vec![
|
||||
playground.with_files(&[
|
||||
Stub::FileWithContent("config.nu", ""),
|
||||
Stub::FileWithContent("env.nu", ""),
|
||||
]);
|
||||
@ -380,7 +380,7 @@ fn warning_on_invalid_plugin_item() {
|
||||
#[test]
|
||||
fn plugin_use_error_not_found() {
|
||||
Playground::setup("plugin use error not found", |dirs, playground| {
|
||||
playground.with_files(vec![
|
||||
playground.with_files(&[
|
||||
Stub::FileWithContent("config.nu", ""),
|
||||
Stub::FileWithContent("env.nu", ""),
|
||||
]);
|
||||
|
@ -109,7 +109,7 @@ fn correct_scope_modules_fields() {
|
||||
"#;
|
||||
|
||||
Playground::setup("correct_scope_modules_fields", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent("spam.nu", module_setup)]);
|
||||
sandbox.with_files(&[FileWithContent("spam.nu", module_setup)]);
|
||||
|
||||
let inp = &[
|
||||
"use spam.nu",
|
||||
@ -191,7 +191,7 @@ fn correct_scope_aliases_fields() {
|
||||
"#;
|
||||
|
||||
Playground::setup("correct_scope_aliases_fields", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent("spam.nu", module_setup)]);
|
||||
sandbox.with_files(&[FileWithContent("spam.nu", module_setup)]);
|
||||
|
||||
let inp = &[
|
||||
"use spam.nu",
|
||||
@ -248,7 +248,7 @@ fn correct_scope_externs_fields() {
|
||||
"#;
|
||||
|
||||
Playground::setup("correct_scope_aliases_fields", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent("spam.nu", module_setup)]);
|
||||
sandbox.with_files(&[FileWithContent("spam.nu", module_setup)]);
|
||||
|
||||
let inp = &[
|
||||
"use spam.nu",
|
||||
|
@ -129,7 +129,7 @@ fn passes_with_env_env_var_to_external_process() {
|
||||
#[test]
|
||||
fn has_file_pwd() {
|
||||
Playground::setup("has_file_pwd", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent("spam.nu", "$env.FILE_PWD")]);
|
||||
sandbox.with_files(&[FileWithContent("spam.nu", "$env.FILE_PWD")]);
|
||||
|
||||
let actual = nu!(cwd: dirs.test(), "nu spam.nu");
|
||||
|
||||
@ -140,7 +140,7 @@ fn has_file_pwd() {
|
||||
#[test]
|
||||
fn has_file_loc() {
|
||||
Playground::setup("has_file_pwd", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent("spam.nu", "$env.CURRENT_FILE")]);
|
||||
sandbox.with_files(&[FileWithContent("spam.nu", "$env.CURRENT_FILE")]);
|
||||
|
||||
let actual = nu!(cwd: dirs.test(), "nu spam.nu");
|
||||
|
||||
@ -154,7 +154,7 @@ fn has_file_loc() {
|
||||
#[serial]
|
||||
fn passes_env_from_local_cfg_to_external_process() {
|
||||
Playground::setup("autoenv_dir", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
".nu-env",
|
||||
r#"[env]
|
||||
FOO = "foo"
|
||||
|
@ -65,7 +65,7 @@ fn nu_lib_dirs_repl() {
|
||||
Playground::setup("nu_lib_dirs_repl", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("scripts")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"scripts/foo.nu",
|
||||
r#"
|
||||
$env.FOO = "foo"
|
||||
@ -90,13 +90,13 @@ fn nu_lib_dirs_script() {
|
||||
Playground::setup("nu_lib_dirs_script", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("scripts")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"scripts/foo.nu",
|
||||
r#"
|
||||
$env.FOO = "foo"
|
||||
"#,
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
source-env foo.nu
|
||||
@ -121,7 +121,7 @@ fn nu_lib_dirs_relative_repl() {
|
||||
Playground::setup("nu_lib_dirs_relative_repl", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("scripts")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"scripts/foo.nu",
|
||||
r#"
|
||||
$env.FOO = "foo"
|
||||
@ -147,13 +147,13 @@ fn const_nu_lib_dirs_relative() {
|
||||
Playground::setup("const_nu_lib_dirs_relative", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("scripts")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"scripts/foo.nu",
|
||||
r#"
|
||||
$env.FOO = "foo"
|
||||
"#,
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"main.nu",
|
||||
"
|
||||
const NU_LIB_DIRS = [ 'scripts' ]
|
||||
@ -174,13 +174,13 @@ fn nu_lib_dirs_relative_script() {
|
||||
Playground::setup("nu_lib_dirs_relative_script", |dirs, sandbox| {
|
||||
sandbox
|
||||
.mkdir("scripts")
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"scripts/main.nu",
|
||||
"
|
||||
source-env ../foo.nu
|
||||
",
|
||||
)])
|
||||
.with_files(vec![FileWithContentToBeTrimmed(
|
||||
.with_files(&[FileWithContentToBeTrimmed(
|
||||
"foo.nu",
|
||||
r#"
|
||||
$env.FOO = "foo"
|
||||
@ -288,7 +288,7 @@ fn run_with_no_newline() {
|
||||
fn main_script_can_have_subcommands1() {
|
||||
Playground::setup("main_subcommands", |dirs, sandbox| {
|
||||
sandbox.mkdir("main_subcommands");
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"script.nu",
|
||||
r#"def "main foo" [x: int] {
|
||||
print ($x + 100)
|
||||
@ -309,7 +309,7 @@ fn main_script_can_have_subcommands1() {
|
||||
fn main_script_can_have_subcommands2() {
|
||||
Playground::setup("main_subcommands", |dirs, sandbox| {
|
||||
sandbox.mkdir("main_subcommands");
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"script.nu",
|
||||
r#"def "main foo" [x: int] {
|
||||
print ($x + 100)
|
||||
@ -330,7 +330,7 @@ fn main_script_can_have_subcommands2() {
|
||||
fn source_empty_file() {
|
||||
Playground::setup("source_empty_file", |dirs, sandbox| {
|
||||
sandbox.mkdir("source_empty_file");
|
||||
sandbox.with_files(vec![FileWithContent("empty.nu", "")]);
|
||||
sandbox.with_files(&[FileWithContent("empty.nu", "")]);
|
||||
|
||||
let actual = nu!(cwd: dirs.test(), pipeline("nu empty.nu"));
|
||||
assert!(actual.out.is_empty());
|
||||
|
@ -168,7 +168,7 @@ fn err_pipe_with_failed_external_works() {
|
||||
#[test]
|
||||
fn dont_run_glob_if_pass_variable_to_external() {
|
||||
Playground::setup("dont_run_glob", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
sandbox.with_files(&[
|
||||
EmptyFile("jt_likes_cake.txt"),
|
||||
EmptyFile("andres_likes_arepas.txt"),
|
||||
]);
|
||||
@ -182,7 +182,7 @@ fn dont_run_glob_if_pass_variable_to_external() {
|
||||
#[test]
|
||||
fn run_glob_if_pass_variable_to_external() {
|
||||
Playground::setup("run_glob_on_external", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
sandbox.with_files(&[
|
||||
EmptyFile("jt_likes_cake.txt"),
|
||||
EmptyFile("andres_likes_arepas.txt"),
|
||||
]);
|
||||
@ -202,7 +202,7 @@ mod it_evaluation {
|
||||
#[test]
|
||||
fn takes_rows_of_nu_value_strings() {
|
||||
Playground::setup("it_argument_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
sandbox.with_files(&[
|
||||
EmptyFile("jt_likes_cake.txt"),
|
||||
EmptyFile("andres_likes_arepas.txt"),
|
||||
]);
|
||||
@ -225,7 +225,7 @@ mod it_evaluation {
|
||||
#[test]
|
||||
fn takes_rows_of_nu_value_lines() {
|
||||
Playground::setup("it_argument_test_2", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"nu_candies.txt",
|
||||
"
|
||||
AndrásWithKitKatzz
|
||||
@ -258,7 +258,7 @@ mod it_evaluation {
|
||||
#[test]
|
||||
fn supports_fetching_given_a_column_path_to_it() {
|
||||
Playground::setup("it_argument_test_3", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
"sample.toml",
|
||||
r#"
|
||||
nu_party_venue = "zion"
|
||||
@ -349,7 +349,7 @@ mod external_words {
|
||||
#[case("$ sign.toml", r#""$ sign.toml""#)]
|
||||
fn external_arg_with_special_characters(#[case] path: &str, #[case] nu_path_argument: &str) {
|
||||
Playground::setup("external_arg_with_quotes", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
sandbox.with_files(&[FileWithContent(
|
||||
path,
|
||||
r#"
|
||||
nu_party_venue = "zion"
|
||||
@ -479,7 +479,7 @@ mod external_command_arguments {
|
||||
Playground::setup(
|
||||
"expands_table_of_primitives_to_positional_arguments",
|
||||
|dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
sandbox.with_files(&[
|
||||
EmptyFile("jt_likes_cake.txt"),
|
||||
EmptyFile("andres_likes_arepas.txt"),
|
||||
EmptyFile("ferris_not_here.txt"),
|
||||
@ -505,7 +505,7 @@ mod external_command_arguments {
|
||||
Playground::setup(
|
||||
"expands_table_of_primitives_to_positional_arguments",
|
||||
|dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
sandbox.with_files(&[
|
||||
EmptyFile("jt_likes_cake.txt"),
|
||||
EmptyFile("andres_likes_arepas.txt"),
|
||||
EmptyFile("ferris_not_here.txt"),
|
||||
@ -531,7 +531,7 @@ mod external_command_arguments {
|
||||
|dirs, sandbox| {
|
||||
sandbox.mkdir("cd");
|
||||
|
||||
sandbox.with_files(vec![EmptyFile("cd/jt_likes_cake.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("cd/jt_likes_cake.txt")]);
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
|
@ -29,7 +29,7 @@ fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
|
||||
#[test]
|
||||
fn treats_dot_dot_as_path_not_range() {
|
||||
Playground::setup("dot_dot_dir", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"nu_times.csv",
|
||||
"
|
||||
name,rusty_luck,origin
|
||||
@ -83,7 +83,7 @@ fn for_loop() {
|
||||
#[test]
|
||||
fn subexpression_handles_dot() {
|
||||
Playground::setup("subexpression_handles_dot", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
sandbox.with_files(&[FileWithContentToBeTrimmed(
|
||||
"nu_times.csv",
|
||||
"
|
||||
name,rusty_luck,origin
|
||||
|
Reference in New Issue
Block a user