forked from extern/nushell
Don't leak set/set-env/source scopes via actions (#2849)
This commit is contained in:
@ -418,6 +418,18 @@ fn set_variable() {
|
||||
assert_eq!(actual.out, "17");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_doesnt_leak() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
do { set x = 5 }; echo $x
|
||||
"#
|
||||
);
|
||||
|
||||
assert!(actual.err.contains("unknown variable"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_env_variable() {
|
||||
let actual = nu!(
|
||||
@ -431,6 +443,18 @@ fn set_env_variable() {
|
||||
assert_eq!(actual.out, "hello world");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_env_doesnt_leak() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
do { set-env xyz = "my message" }; echo $nu.env.xyz
|
||||
"#
|
||||
);
|
||||
|
||||
assert!(actual.err.contains("did you mean"));
|
||||
}
|
||||
|
||||
#[cfg(feature = "which")]
|
||||
#[test]
|
||||
fn argument_invocation_reports_errors() {
|
||||
|
Reference in New Issue
Block a user