forked from extern/nushell
Properly handle commands defined inside of other commands (#2837)
* Fix function inner scopes * tweak error
This commit is contained in:
@ -380,6 +380,30 @@ fn run_custom_subcommand() {
|
||||
assert_eq!(actual.out, "bobbob");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_inner_custom_command() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
def outer [x] { def inner [y] { echo $y }; inner $x }; outer 10
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "10");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_broken_inner_custom_command() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
def outer [x] { def inner [y] { echo $y }; inner $x }; inner 10
|
||||
"#
|
||||
);
|
||||
|
||||
assert!(actual.err.contains("not found"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_variable() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user