Fix single quote external interpolation (#4867)

This commit is contained in:
JT 2022-03-18 19:59:28 +13:00 committed by GitHub
parent d0cbb2d12c
commit 7773c4cd4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -263,7 +263,11 @@ pub fn parse_external_call(
let contents = working_set.get_span_contents(*span);
if contents.starts_with(b"$") || contents.starts_with(b"(") {
let (arg, err) = parse_expression(working_set, &[*span], true);
let (arg, err) = parse_dollar_expr(working_set, *span);
error = error.or(err);
args.push(arg);
} else if contents.starts_with(b"(") {
let (arg, err) = parse_full_cell_path(working_set, None, *span);
error = error.or(err);
args.push(arg);
} else {

View file

@ -83,8 +83,13 @@ fn execute_binary_in_string() {
assert_eq!(actual.out, "$0");
}
//FIXME: jt - this is blocked on https://github.com/nushell/engine-q/issues/875
#[ignore]
#[test]
fn single_quote_dollar_external() {
let actual = nu!(cwd: ".", r#"let author = 'JT'; ^echo $'foo=($author)'"#);
assert_eq!(actual.out, "foo=JT");
}
#[test]
fn redirects_custom_command_external() {
let actual = nu!(cwd: ".", r#"def foo [] { nu --testbin cococo foo bar }; foo | str length"#);