mirror of
https://github.com/nushell/nushell.git
synced 2025-06-17 23:46:50 +02:00
Fix reject regression (#14931)
This PR solves the regression introduced by #14622 (sorry about that). It also adds a test to cover the regression. Closes #14929.
This commit is contained in:
parent
c0b4d19761
commit
a2705f9eb5
@ -220,8 +220,14 @@ fn reject(
|
|||||||
|
|
||||||
new_columns.append(&mut new_rows);
|
new_columns.append(&mut new_rows);
|
||||||
|
|
||||||
|
let has_integer_path_member = new_columns.iter().any(|path| {
|
||||||
|
path.members
|
||||||
|
.iter()
|
||||||
|
.any(|member| matches!(member, PathMember::Int { .. }))
|
||||||
|
});
|
||||||
|
|
||||||
match input {
|
match input {
|
||||||
PipelineData::ListStream(stream, ..) => {
|
PipelineData::ListStream(stream, ..) if !has_integer_path_member => {
|
||||||
let result = stream
|
let result = stream
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(move |mut value| {
|
.map(move |mut value| {
|
||||||
|
@ -178,3 +178,10 @@ fn test_ignore_errors_flag_var() {
|
|||||||
nu!("let arg = [5 c]; [[a, b]; [1, 2], [3, 4], [5, 6]] | reject ...$arg -i | to nuon");
|
nu!("let arg = [5 c]; [[a, b]; [1, 2], [3, 4], [5, 6]] | reject ...$arg -i | to nuon");
|
||||||
assert_eq!(actual.out, "[[a, b]; [1, 2], [3, 4], [5, 6]]");
|
assert_eq!(actual.out, "[[a, b]; [1, 2], [3, 4], [5, 6]]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_works_with_integer_path_and_stream() {
|
||||||
|
let actual = nu!("[[N u s h e l l]] | flatten | reject 1 | to nuon");
|
||||||
|
|
||||||
|
assert_eq!(actual.out, "[N, s, h, e, l, l]");
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user