2022-03-17 23:35:50 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn alias_simple() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
2022-08-31 22:32:56 +02:00
|
|
|
alias bar = use sample_def.nu greet;
|
|
|
|
bar;
|
|
|
|
greet
|
2022-03-17 23:35:50 +01:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "hello");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2022-08-31 22:32:56 +02:00
|
|
|
fn alias_hiding_1() {
|
2022-03-17 23:35:50 +01:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
2022-08-31 22:32:56 +02:00
|
|
|
overlay use ./activate-foo.nu;
|
|
|
|
$nu.scope.aliases | find deactivate-foo | length
|
2022-03-17 23:35:50 +01:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "1");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2022-08-31 22:32:56 +02:00
|
|
|
fn alias_hiding_2() {
|
2022-03-17 23:35:50 +01:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
2022-08-31 22:32:56 +02:00
|
|
|
overlay use ./activate-foo.nu;
|
|
|
|
deactivate-foo;
|
|
|
|
$nu.scope.aliases | find deactivate-foo | length
|
2022-03-17 23:35:50 +01:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "0");
|
|
|
|
}
|