Simplify string interpolation (#3401)

* [DRAFT] simplify string interpolation

* Fix test
This commit is contained in:
JT
2021-05-12 13:53:57 +12:00
committed by GitHub
parent 25a8caa9b0
commit 311c0e3f50
6 changed files with 62 additions and 117 deletions

View File

@ -118,55 +118,19 @@ fn string_interpolation_with_it() {
let actual = nu!(
cwd: ".",
r#"
echo "foo" | each { echo `{{$it}}` }
echo "foo" | each { echo $"{$it}" }
"#
);
assert_eq!(actual.out, "foo");
}
#[test]
fn string_interpolation_with_column() {
let actual = nu!(
cwd: ".",
r#"
echo [[name]; [bob]] | each { echo `{{name}} is cool` }
"#
);
assert_eq!(actual.out, "bob is cool");
}
#[test]
fn string_interpolation_with_column2() {
let actual = nu!(
cwd: ".",
r#"
echo [[name]; [fred]] | each { echo `also {{name}} is cool` }
"#
);
assert_eq!(actual.out, "also fred is cool");
}
#[test]
fn string_interpolation_with_column3() {
let actual = nu!(
cwd: ".",
r#"
echo [[name]; [sally]] | each { echo `also {{name}}` }
"#
);
assert_eq!(actual.out, "also sally");
}
#[test]
fn string_interpolation_with_it_column_path() {
let actual = nu!(
cwd: ".",
r#"
echo [[name]; [sammie]] | each { echo `{{$it.name}}` }
echo [[name]; [sammie]] | each { echo $"{$it.name}" }
"#
);