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
This commit is contained in:
Stefan Holderbach 2023-07-27 21:32:25 +02:00 committed by GitHub
parent 78e29af423
commit 3481c7e242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -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(

View file

@ -45,5 +45,14 @@ fn to_row() {
));
assert!(actual.out.contains('5'));
let actual = nu!(r#"
def foo [a: list<string>] {
$a | describe
}
foo (["a b", "c d"] | split row " ")
"#);
assert!(actual.out.contains("list<string>"));
})
}