mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Fixed the panic when type a statement similar to let f = 'f' $
in the nushell (#9851)
- this PR should close #9596 - fixes #9596 - this PR should close #9826 - fixes #9826 fixed the following bugs: ```nu # type following statements in the nushell let f = 'f' $; mut f = 'f' $; const f = 'f' $; # then remove variable f, it will panics let = 'f' $; mut = 'f' $; const = 'f' $; ```
This commit is contained in:
@ -145,6 +145,25 @@ fn bad_var_name2() -> TestResult {
|
||||
fail_test(r#"let $foo-bar = 4"#, "valid variable")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assignment_with_no_var() -> TestResult {
|
||||
let cases = [
|
||||
"let = if $",
|
||||
"mut = if $",
|
||||
"const = if $",
|
||||
"let = 'foo' | $in; $x | describe",
|
||||
"mut = 'foo' | $in; $x | describe",
|
||||
];
|
||||
|
||||
let expected = "valid variable";
|
||||
|
||||
for case in cases {
|
||||
fail_test(case, expected)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn long_flag() -> TestResult {
|
||||
run_test(
|
||||
|
Reference in New Issue
Block a user