mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Fix(tests/nu-command): remove unnecessary cwd() and pipeline(), etc (#8711)
# Description This PR aims to cover the tests under nu-command as part of this issue #8670 to clean up any unnecessary wrapping funcs like `cwd(".")` or `pipeline()`, etc. This PR is still WIP and opening as draft to get first impressions and feedback on a few tests before I go on changing more. # User-Facing Changes None # Tests + Formatting None # After Submitting None --------- Signed-off-by: Harshal Chaudhari <harshal.chaudhary@gmail.com> Co-authored-by: Reilly Wood <reilly.wood@icloud.com>
This commit is contained in:
committed by
GitHub
parent
61fa826159
commit
3fab427383
@ -49,47 +49,23 @@ fn alias_hiding_2() {
|
||||
#[test]
|
||||
fn alias_fails_with_invalid_name() {
|
||||
let err_msg = "name can't be a number, a filesize, or contain a hash # or caret ^";
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
alias 1234 = echo "test"
|
||||
"#
|
||||
));
|
||||
let actual = nu!(r#" alias 1234 = echo "test" "#);
|
||||
|
||||
assert!(actual.err.contains(err_msg));
|
||||
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
alias 5gib = echo "test"
|
||||
"#
|
||||
));
|
||||
let actual = nu!(r#" alias 5gib = echo "test" "#);
|
||||
assert!(actual.err.contains(err_msg));
|
||||
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
alias "te#t" = echo "test"
|
||||
"#
|
||||
));
|
||||
let actual = nu!(r#" alias "te#t" = echo "test" "#);
|
||||
assert!(actual.err.contains(err_msg));
|
||||
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
alias ^foo = echo "bar"
|
||||
"#
|
||||
));
|
||||
let actual = nu!(r#" alias ^foo = echo "bar" "#);
|
||||
assert!(actual.err.contains(err_msg));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cant_alias_keyword() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
alias ou = let
|
||||
"#
|
||||
));
|
||||
let actual = nu!(r#" alias ou = let "#);
|
||||
assert!(actual.err.contains("cant_alias_keyword"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user