mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 02:38:37 +02:00
Allow "export-env" parsing in modules (#6382)
* Allow "export-env" parsing in modules * Fmt * Add test for importing module's environment
This commit is contained in:
@ -345,3 +345,21 @@ fn module_nested_imports_in_dirs_prefixed() {
|
||||
assert_eq!(actual.out, "bar");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_eval_export_env() {
|
||||
Playground::setup("module_eval_export_env", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"spam.nu",
|
||||
r#"
|
||||
export-env { let-env FOO = 'foo' }
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let inp = &[r#"source spam.nu"#, r#"$env.FOO"#];
|
||||
|
||||
let actual = nu!(cwd: dirs.test(), pipeline(&inp.join("; ")));
|
||||
|
||||
assert_eq!(actual.out, "foo");
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user