cli-test: Path separation compatible with Windows
Running tests on Windows requires separating the path to executables by `;`.
This commit is contained in:
parent
faeee9f370
commit
ffbbb374c1
|
|
@ -170,6 +170,11 @@ pub struct TestFormula {
|
||||||
|
|
||||||
impl TestFormula {
|
impl TestFormula {
|
||||||
pub fn new(cwd: PathBuf) -> Self {
|
pub fn new(cwd: PathBuf) -> Self {
|
||||||
|
#[cfg(windows)]
|
||||||
|
const PATH_SEPARATOR: char = ';';
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
const PATH_SEPARATOR: char = ':';
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
cwd: cwd.clone(),
|
cwd: cwd.clone(),
|
||||||
env: HashMap::new(),
|
env: HashMap::new(),
|
||||||
|
|
@ -178,7 +183,8 @@ impl TestFormula {
|
||||||
subs: Substitutions::new(),
|
subs: Substitutions::new(),
|
||||||
bins: env::var("PATH")
|
bins: env::var("PATH")
|
||||||
.map(|env_path| {
|
.map(|env_path| {
|
||||||
let mut bins: Vec<PathBuf> = env_path.split(':').map(PathBuf::from).collect();
|
let mut bins: Vec<PathBuf> =
|
||||||
|
env_path.split(PATH_SEPARATOR).map(PathBuf::from).collect();
|
||||||
// Add current working directory to `$PATH`,
|
// Add current working directory to `$PATH`,
|
||||||
// this makes it more convenient to execute scripts during testing.
|
// this makes it more convenient to execute scripts during testing.
|
||||||
bins.push(cwd);
|
bins.push(cwd);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue