forked from extern/nushell
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:
@ -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")
|
||||
);
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user