2022-06-24 23:55:25 +02:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn let_parse_error() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
let in = 3
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert!(actual
|
|
|
|
.err
|
|
|
|
.contains("'in' is the name of a builtin Nushell variable"));
|
|
|
|
}
|
2022-11-11 07:51:08 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn let_doesnt_mutate() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
let i = 3; $i = 4
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert!(actual.err.contains("immutable"));
|
|
|
|
}
|
2023-02-22 18:35:09 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn let_with_external_failed() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".",
|
|
|
|
pipeline(r#"let x = nu --testbin outcome_err "aa"; echo fail"#)
|
|
|
|
);
|
|
|
|
|
|
|
|
assert!(!actual.out.contains("fail"));
|
|
|
|
}
|