Improve external quoting logic (#3579)

* Add tests and improve quoting logic

* fmt

* Fix clippy ling

* Fix clippy ling
This commit is contained in:
JT
2021-06-09 08:59:53 +12:00
committed by GitHub
parent e9de4c08b0
commit a021b99614
5 changed files with 56 additions and 4 deletions

View File

@ -199,7 +199,8 @@ mod stdin_evaluation {
mod external_words {
use super::nu;
use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::{pipeline, playground::Playground};
#[test]
fn relaxed_external_words() {
let actual = nu!(cwd: ".", r#"
@ -217,6 +218,27 @@ mod external_words {
assert_eq!(actual.out, "test \"things\"");
}
#[test]
fn external_arg_with_quotes() {
Playground::setup("external_arg_with_quotes", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContent(
"sample.toml",
r#"
nu_party_venue = "zion"
"#,
)]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
nu --testbin meow "sample.toml" | from toml | get nu_party_venue
"#
));
assert_eq!(actual.out, "zion");
})
}
}
mod nu_commands {