mirror of
https://github.com/nushell/nushell.git
synced 2024-11-29 20:03:54 +01:00
7dc1d6a350
The autoenv logic mutates environment variables in the running session as it operates and decides what to do for trusted directories containing `.nu-env` files. Few of the ways to interact with it were all in a single test function. We separate out all the ways that were done in the single test function to document it better. This will greatly help once we start refactoring our way out from setting environment variables this way to just setting them to `Scope`. This is part of an on-going effort to keep variables (`PATH` and `ENV`) in our `Scope` and rely on it for everything related to variables. We expect to move away from setting (`std::*`) envrironment variables in the current running process. This is non-trivial since we need to handle cases from vars coming in from the outside world, prioritize, and also compare to the ones we have both stored in memory and in configuration files. Also to send out our in-memory (in `Scope`) variables properly to external programs once we no longer rely on `std::env` vars from the running process.
41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[cfg(feature = "directories-support")]
|
|
#[cfg(feature = "which-support")]
|
|
mod environment;
|
|
|
|
mod pipeline;
|
|
|
|
#[test]
|
|
fn plugins_are_declared_with_wix() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
open Cargo.toml
|
|
| get bin.name
|
|
| str find-replace "nu_plugin_(extra|core)_(.*)" "nu_plugin_$2"
|
|
| drop
|
|
| sort-by
|
|
| wrap cargo | merge {
|
|
open wix/main.wxs --raw | from xml
|
|
| get Wix.children.Product.children.0.Directory.children.0
|
|
| where Directory.attributes.Id == "$(var.PlatformProgramFilesFolder)"
|
|
| get Directory.children.Directory.children.0 | last
|
|
| get Directory.children.Component.children
|
|
| each { echo $it | first }
|
|
| skip
|
|
| where File.attributes.Name =~ "nu_plugin"
|
|
| str substring [_, -4] File.attributes.Name
|
|
| get File.attributes.Name
|
|
| sort-by
|
|
| wrap wix
|
|
}
|
|
| default wix _
|
|
| each { if $it.wix != $it.cargo { = 1 } { = 0 } }
|
|
| math sum
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "0");
|
|
}
|