Add set-env for setting environment variables (#2802)

This commit is contained in:
Jonathan Turner
2020-12-19 19:25:03 +13:00
committed by GitHub
parent 2a483531a4
commit 058ef69da3
7 changed files with 131 additions and 2 deletions

View File

@ -345,7 +345,7 @@ fn run_custom_command() {
}
#[test]
fn set_variables() {
fn set_variable() {
let actual = nu!(
cwd: ".",
r#"
@ -358,6 +358,19 @@ fn set_variables() {
assert_eq!(actual.out, "17");
}
#[test]
fn set_env_variable() {
let actual = nu!(
cwd: ".",
r#"
set-env TESTENVVAR = "hello world"
echo $nu.env.TESTENVVAR
"#
);
assert_eq!(actual.out, "hello world");
}
#[cfg(feature = "which")]
#[test]
fn argument_invocation_reports_errors() {