nushell/src/tests/test_env.rs
Wind cf8fcef9bf
set the type of default NU_LIB_DIRS and NU_PLUGIN_DIRS to list<string> (#12573)
# Description
Fix: #12489

I believe the issue it's because the default value of `NU_LIB_DIRS` and
`NU_PLUGIN_DIRS` is a string, but it should be a list.

So if users don't set up these values in `env.nu`, we will get a
problem.
2024-04-20 10:04:41 -05:00

29 lines
664 B
Rust

use crate::tests::{fail_test, run_test, TestResult};
use nu_test_support::nu;
#[test]
fn shorthand_env_1() -> TestResult {
run_test(r#"FOO=BAZ $env.FOO"#, "BAZ")
}
#[test]
fn shorthand_env_2() -> TestResult {
fail_test(r#"FOO=BAZ FOO=MOO $env.FOO"#, "defined_twice")
}
#[test]
fn shorthand_env_3() -> TestResult {
run_test(r#"FOO=BAZ BAR=MOO $env.FOO"#, "BAZ")
}
#[test]
fn default_nu_lib_dirs_type() {
let actual = nu!("$env.NU_LIB_DIRS | describe");
assert_eq!(actual.out, "list<string>");
}
#[test]
fn default_nu_plugin_dirs_type() {
let actual = nu!("$env.NU_PLUGIN_DIRS | describe");
assert_eq!(actual.out, "list<string>");
}