From 3481c7e2420e77ddb6daca8edcb6b11db25a95e8 Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Thu, 27 Jul 2023 21:32:25 +0200 Subject: [PATCH] Fix signature of `split row` (#9829) # Description This command also flat-maps and doesn't create a table like `split column` We should probably reconsider the flatmap behavior like in #9739 but for the #9812 hotfix this is an unwelcome breaking change. # User-Facing Changes None # Tests + Formatting - Fix signature of `split row` - Add test for output signature --- crates/nu-command/src/strings/split/row.rs | 5 ++++- crates/nu-command/tests/commands/split_row.rs | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/strings/split/row.rs b/crates/nu-command/src/strings/split/row.rs index 71cc0bc7c3..8d2eaa9be6 100644 --- a/crates/nu-command/src/strings/split/row.rs +++ b/crates/nu-command/src/strings/split/row.rs @@ -18,7 +18,10 @@ impl Command for SubCommand { Signature::build("split row") .input_output_types(vec![ (Type::String, Type::List(Box::new(Type::String))), - (Type::List(Box::new(Type::String)), Type::Table(vec![])), + ( + Type::List(Box::new(Type::String)), + (Type::List(Box::new(Type::String))), + ), ]) .allow_variants_without_examples(true) .required( diff --git a/crates/nu-command/tests/commands/split_row.rs b/crates/nu-command/tests/commands/split_row.rs index 0517213108..c5017b88c4 100644 --- a/crates/nu-command/tests/commands/split_row.rs +++ b/crates/nu-command/tests/commands/split_row.rs @@ -45,5 +45,14 @@ fn to_row() { )); assert!(actual.out.contains('5')); + + let actual = nu!(r#" + def foo [a: list] { + $a | describe + } + foo (["a b", "c d"] | split row " ") + "#); + + assert!(actual.out.contains("list")); }) }