2024-05-13 13:37:53 +00:00
|
|
|
use crate::repl::tests::{fail_test, run_test, TestResult};
|
2024-04-20 15:04:41 +00:00
|
|
|
use nu_test_support::nu;
|
2021-12-25 19:39:42 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shorthand_env_1() -> TestResult {
|
2022-01-04 21:34:42 +00:00
|
|
|
run_test(r#"FOO=BAZ $env.FOO"#, "BAZ")
|
2021-12-25 19:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shorthand_env_2() -> TestResult {
|
2024-04-16 11:08:58 +00:00
|
|
|
fail_test(r#"FOO=BAZ FOO=MOO $env.FOO"#, "defined_twice")
|
2021-12-25 19:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shorthand_env_3() -> TestResult {
|
2022-01-04 21:34:42 +00:00
|
|
|
run_test(r#"FOO=BAZ BAR=MOO $env.FOO"#, "BAZ")
|
2021-12-25 19:39:42 +00:00
|
|
|
}
|
2024-04-20 15:04:41 +00:00
|
|
|
|
|
|
|
#[test]
|
2024-12-10 12:36:05 +00:00
|
|
|
fn default_nu_lib_dirs_env_type() {
|
|
|
|
// Previously, this was a list<string>
|
|
|
|
// While we are transitioning to const NU_LIB_DIRS
|
|
|
|
// the env version will be empty, and thus a
|
|
|
|
// list<any>
|
2024-04-20 15:04:41 +00:00
|
|
|
let actual = nu!("$env.NU_LIB_DIRS | describe");
|
2024-12-10 12:36:05 +00:00
|
|
|
assert_eq!(actual.out, "list<any>");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn default_nu_lib_dirs_type() {
|
|
|
|
let actual = nu!("$NU_LIB_DIRS | describe");
|
2024-04-20 15:04:41 +00:00
|
|
|
assert_eq!(actual.out, "list<string>");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2024-12-11 17:41:06 +00:00
|
|
|
fn default_nu_plugin_dirs_env_type() {
|
|
|
|
// Previously, this was a list<string>
|
|
|
|
// While we are transitioning to const NU_PLUGIN_DIRS
|
|
|
|
// the env version will be empty, and thus a
|
|
|
|
// list<any>
|
2024-04-20 15:04:41 +00:00
|
|
|
let actual = nu!("$env.NU_PLUGIN_DIRS | describe");
|
2024-12-11 17:41:06 +00:00
|
|
|
assert_eq!(actual.out, "list<any>");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn default_nu_plugin_dirs_type() {
|
|
|
|
let actual = nu!("$NU_PLUGIN_DIRS | describe");
|
2024-04-20 15:04:41 +00:00
|
|
|
assert_eq!(actual.out, "list<string>");
|
|
|
|
}
|