mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
prevent alias name from being filesize or number (#6595)
* prevent alias name from being filesize or number * add test * fmt
This commit is contained in:
@ -40,3 +40,25 @@ fn alias_hiding_2() {
|
||||
|
||||
assert_eq!(actual.out, "0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_fails_with_invalid_name() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
alias 1234 = echo "test"
|
||||
"#
|
||||
));
|
||||
assert!(actual
|
||||
.err
|
||||
.contains("alias name can't be a number or a filesize"));
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
alias 5gib = echo "test"
|
||||
"#
|
||||
));
|
||||
assert!(actual
|
||||
.err
|
||||
.contains("alias name can't be a number or a filesize"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user