mirror of
https://github.com/nushell/nushell.git
synced 2024-12-01 21:03:58 +01:00
c42b588782
* Revert "History, more test coverage improvements, and refactorings. (#3217)"
This reverts commit 8fc8fc89aa
.
* Add tests
* Refactor .nu-env
* Change logic of Config write to logic of read()
* Fix reload always appends to old vars
* Fix reload always takes last_modified of global config
* Add reload_config in evaluation context
* Reload config after writing to it in cfg set / cfg set_into
* Add --no-history to cli options
* Use --no-history in tests
* Add comment about maybe_print_errors
* Get ctrl_exit var from context.global_config
* Use context.global_config in command "config"
* Add Readme in engine how env vars are now handled
* Update docs from autoenv command
* Move history_path from engine to nu_data
* Move load history out of if
* No let before return
* Add import for indexmap
46 lines
1.0 KiB
Rust
46 lines
1.0 KiB
Rust
use super::support::Trusted;
|
|
|
|
use nu_test_support::fs::Stub::FileWithContent;
|
|
use nu_test_support::nu;
|
|
use nu_test_support::playground::Playground;
|
|
|
|
use serial_test::serial;
|
|
|
|
#[test]
|
|
fn passes_let_env_env_var_to_external_process() {
|
|
let actual = nu!(cwd: ".", r#"
|
|
let-env FOO = foo
|
|
nu --testbin echo_env FOO
|
|
"#);
|
|
assert_eq!(actual.out, "foo");
|
|
}
|
|
|
|
#[test]
|
|
fn passes_with_env_env_var_to_external_process() {
|
|
let actual = nu!(cwd: ".", r#"
|
|
with-env [FOO foo] {nu --testbin echo_env FOO}
|
|
"#);
|
|
assert_eq!(actual.out, "foo");
|
|
}
|
|
|
|
#[test]
|
|
#[serial]
|
|
fn passes_env_from_local_cfg_to_external_process() {
|
|
Playground::setup("autoenv_dir", |dirs, sandbox| {
|
|
sandbox.with_files(vec![FileWithContent(
|
|
".nu-env",
|
|
r#"[env]
|
|
FOO = "foo"
|
|
"#,
|
|
)]);
|
|
|
|
let actual = Trusted::in_path(&dirs, || {
|
|
nu!(cwd: dirs.test(), r#"
|
|
nu --testbin echo_env FOO
|
|
"#)
|
|
});
|
|
|
|
assert_eq!(actual.out, "foo");
|
|
})
|
|
}
|