mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 07:55:59 +02:00
Allow empty list inputs in group-by
and return empty record (#10730)
# Description Changed `group-by` behavior to accept empty list as input and return an empty record instead of throwing an error. I also replaced `errors_if_input_empty()` test to reflect the new expected behavior. See #10713 # User-Facing Changes `[] | group-by` or `[] | group-by a` now returns empty record # Tests + Formatting 1 test for emptied table i.e. list --------- Signed-off-by: Oscar <71343264+0scvr@users.noreply.github.com>
This commit is contained in:
@ -97,9 +97,10 @@ fn errors_if_column_not_found() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn errors_if_input_empty() {
|
||||
let actual = nu!("group-by date");
|
||||
assert!(actual.err.contains("expected table from pipeline"));
|
||||
fn group_by_on_empty_list_returns_empty_record() {
|
||||
let actual = nu!("[[a b]; [1 2]] | where false | group-by a");
|
||||
assert!(actual.err.is_empty());
|
||||
assert!(actual.out.contains("empty record"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user