mirror of
https://github.com/nushell/nushell
synced 2025-01-12 21:29:07 +00:00
Refactor result as immutable; test import adjustment
This commit is contained in:
parent
e09a1ce874
commit
e1b81081a2
2 changed files with 7 additions and 9 deletions
|
@ -200,15 +200,13 @@ pub mod windows {
|
|||
#[cfg(test)] // test only for windows
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::IntoValue; // Only used in test, if placed at the beginning, will cause "unused import" warning at not(test) cfg
|
||||
|
||||
#[test]
|
||||
fn test_expand_path_with() {
|
||||
let mut stack = Stack::new();
|
||||
let path_str = r"c:\users\nushell";
|
||||
let result = set_pwd(
|
||||
&mut stack,
|
||||
crate::IntoValue::into_value(path_str, Span::unknown()),
|
||||
);
|
||||
let result = set_pwd(&mut stack, path_str.into_value(Span::unknown()));
|
||||
assert_eq!(result, Ok(()));
|
||||
let engine_state = EngineState::new();
|
||||
|
||||
|
|
|
@ -259,11 +259,11 @@ impl Stack {
|
|||
#[cfg(not(windows))]
|
||||
let result = Ok(());
|
||||
#[cfg(windows)]
|
||||
let mut result = Ok(());
|
||||
#[cfg(windows)]
|
||||
if var == "PWD" {
|
||||
result = set_pwd(self, value.clone())
|
||||
}
|
||||
let result = if var == "PWD" {
|
||||
set_pwd(self, value.clone())
|
||||
} else {
|
||||
Ok(())
|
||||
};
|
||||
|
||||
if let Some(last_overlay) = self.active_overlays.last() {
|
||||
if let Some(env_hidden) = Arc::make_mut(&mut self.env_hidden).get_mut(last_overlay) {
|
||||
|
|
Loading…
Reference in a new issue