mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Allow expanding aliases before keywords, improve hiding (#4858)
* Allow aliasing source * Add test * improve hiding * Finish adding tests * fix test
This commit is contained in:
40
crates/nu-command/tests/commands/alias.rs
Normal file
40
crates/nu-command/tests/commands/alias.rs
Normal file
@ -0,0 +1,40 @@
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn alias_simple() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
alias bar = source sample_def.nu; bar; greet
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "hello");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_hiding1() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
source ./activate-foo.nu;
|
||||
$nu.scope.aliases | find deactivate-foo | length
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_hiding2() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
source ./activate-foo.nu;
|
||||
deactivate-foo;
|
||||
$nu.scope.aliases | find deactivate-foo | length
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "0");
|
||||
}
|
Reference in New Issue
Block a user