forked from extern/nushell
Allow different names for ...rest (#3954)
* Allow different names for ...rest * Resolves #3945 * This change requires an explicit name for the rest argument in `WholeStreamCommand`, which is why there are so many changed files. * Remove redundant clone * Add tests
This commit is contained in:
@ -373,6 +373,25 @@ fn run_custom_command_with_empty_rest() {
|
||||
assert_eq!(actual.err, r#""#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_custom_command_with_rest_other_name() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
def say-hello [
|
||||
greeting:string,
|
||||
...names:string # All of the names
|
||||
] {
|
||||
echo $"($greeting), ($names | sort-by | str collect ' ')"
|
||||
}
|
||||
say-hello Salutations E D C A B
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, r#"Salutations, A B C D E"#);
|
||||
assert_eq!(actual.err, r#""#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_a_load_env() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user