mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 23:49:44 +01:00
# Description Functionality added by @nabacg in #7961 already h/t @YuriGeinishO for the example in #7933 Closes #7933 # User-Facing Changes None # Tests + Formatting +1 end to end example
This commit is contained in:
parent
4c308b7f2f
commit
b796cda060
@ -46,6 +46,25 @@ fn reduce_rows_example() {
|
||||
assert_eq!(actual.out, "14.8");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reduce_with_return_in_closure() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[1, 2] | reduce --fold null { |it, state|
|
||||
if $it == 1 {
|
||||
return 10
|
||||
};
|
||||
return ($it * $state)
|
||||
}
|
||||
"#
|
||||
)
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "20");
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reduce_enumerate_example() {
|
||||
let actual = nu!(
|
||||
|
Loading…
Reference in New Issue
Block a user