Fix failing unit tests on Windows (#5142) (#5143)

* Fix failing unit tests on Windows (#5142)

Fix let_env_expressions failing on Windows:
The env expression uses PATH, but on windows Path is used.

Fix correctly_escape_external_arguments, execute_binary_in_string
failing on Windows:
Using cococo now to make sure testresults are platform independent

* Update macros.rs

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
This commit is contained in:
Boy van Duuren
2022-04-11 20:18:46 +02:00
committed by GitHub
parent 57761149f4
commit 594006cfa0
3 changed files with 28 additions and 7 deletions

View File

@ -1,4 +1,5 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::tests::{fail_test, run_test, run_test_with_env, TestResult};
use std::collections::HashMap;
use super::run_test_contains;
@ -197,9 +198,11 @@ fn equals_separates_long_flag() -> TestResult {
#[test]
fn let_env_expressions() -> TestResult {
run_test(
r#"let-env PATH = if (env | any? name == VENV_OLD_PATH) { $env.VENV_OLD_PATH } else { $env.PATH }; echo done"#,
"done",
let env = HashMap::from([("VENV_OLD_PATH", "Foobar"), ("Path", "Quux")]);
run_test_with_env(
r#"let-env Path = if (env | any? name == VENV_OLD_PATH) { $env.VENV_OLD_PATH } else { $env.Path }; echo $env.Path"#,
"Foobar",
&env,
)
}