allow early return outside of main (#10514)

# Description
Fixes: #9792

When evaluating file, we need to allow early return if we evaluate
script file first.
This commit is contained in:
WindSoilder
2023-09-29 00:49:42 +08:00
committed by GitHub
parent 80220b722b
commit 9c52b93975
3 changed files with 27 additions and 3 deletions

View File

@ -23,3 +23,12 @@ fn return_works_in_script_without_def_main() {
assert!(actual.err.is_empty());
}
#[test]
fn return_works_in_script_with_def_main() {
let actual = nu!(
cwd: "tests/fixtures/formats",
pipeline("nu early_return_outside_main.nu")
);
assert!(actual.err.is_empty());
}