echo $scope.aliases | pivot to see all of your aliases (#3203)

* enable ability to see all aliases, pull in code from scope branch

* add in the alias tests

* add back in my changes to variables.rs after merging in andrasios changes from PR #3217
This commit is contained in:
Michael Angerman
2021-03-29 01:27:51 -07:00
committed by GitHub
parent 2517588d7d
commit c448abd44e
4 changed files with 96 additions and 1 deletions

View File

@ -32,3 +32,39 @@ fn custom_config_path_variable_present() {
);
})
}
#[test]
fn scope_variable_with_alias_present() {
Playground::setup("scope_variable_alias_test_1", |dirs, nu| {
let file = AbsolutePath::new(dirs.test().join("config.toml"));
nu.with_config(&file);
nu.with_files(vec![FileWithContent(
"config.toml",
"skip_welcome_message = true",
)]);
assert_that!(
nu.pipeline("alias t = time; echo $scope.aliases | get t"),
says().to_stdout("time")
);
})
}
#[test]
fn scope_variable_with_correct_number_of_aliases_present() {
Playground::setup("scope_variable_alias_test_2", |dirs, nu| {
let file = AbsolutePath::new(dirs.test().join("config.toml"));
nu.with_config(&file);
nu.with_files(vec![FileWithContent(
"config.toml",
"skip_welcome_message = true",
)]);
assert_that!(
nu.pipeline("alias v = version; alias t = time; echo $scope.aliases | length -c"),
says().to_stdout("2")
);
})
}