mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 08:01:30 +02:00
Add in parameter inference for blocks (#2706)
This commit is contained in:
@@ -47,3 +47,27 @@ fn each_window_stride() {
|
||||
|
||||
assert_eq!(actual.out, "[[1,2,3],[3,4,5]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_no_args_in_block() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
echo [[foo bar]; [a b] [c d] [e f]] | each { to json } | nth 1 | str collect
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, r#"{"foo":"c","bar":"d"}"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_implicit_it_in_block() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
echo [[foo bar]; [a b] [c d] [e f]] | each { nu --testbin cococo $it.foo }
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "ace");
|
||||
}
|
||||
|
Reference in New Issue
Block a user