Add built-in var to refer to pipeline values (#3661)

This commit is contained in:
JT
2021-06-21 12:31:01 +12:00
committed by GitHub
parent 21a3ceee92
commit 318d13ed58
7 changed files with 203 additions and 41 deletions

View File

@ -1004,6 +1004,30 @@ fn date_and_duration_overflow() {
assert!(actual.err.contains("Duration and date addition overflow"));
}
#[test]
fn pipeline_params_simple() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 1 2 3 | $in.1 * $in.2
"#)
);
assert_eq!(actual.out, "6");
}
#[test]
fn pipeline_params_inner() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 1 2 3 | (echo $in.2 6 7 | $in.0 * $in.1 * $in.2)
"#)
);
assert_eq!(actual.out, "126");
}
mod parse {
use nu_test_support::nu;