Try to fix test runner on Windows

This commit is contained in:
Filip Tibell 2024-05-12 00:56:45 +02:00
parent ae1ab35ee5
commit 2a7a198d58
No known key found for this signature in database

View file

@ -1,4 +1,5 @@
use std::env::set_current_dir; use std::env::set_current_dir;
use std::path::PathBuf;
use std::process::ExitCode; use std::process::ExitCode;
use anyhow::Result; use anyhow::Result;
@ -6,6 +7,8 @@ use console::set_colors_enabled;
use console::set_colors_enabled_stderr; use console::set_colors_enabled_stderr;
use tokio::fs::read_to_string; use tokio::fs::read_to_string;
use lune_utils::path::clean_path_and_make_absolute;
use crate::Runtime; use crate::Runtime;
const ARGS: &[&str] = &["Foo", "Bar"]; const ARGS: &[&str] = &["Foo", "Bar"];
@ -17,7 +20,7 @@ macro_rules! create_tests {
// We need to change the current directory to the workspace root since // We need to change the current directory to the workspace root since
// we are in a sub-crate and tests would run relative to the sub-crate // we are in a sub-crate and tests would run relative to the sub-crate
let workspace_dir_str = format!("{}/../../", env!("CARGO_MANIFEST_DIR")); let workspace_dir_str = format!("{}/../../", env!("CARGO_MANIFEST_DIR"));
let workspace_dir = std::path::PathBuf::from(workspace_dir_str).canonicalize()?; let workspace_dir = clean_path_and_make_absolute(PathBuf::from(workspace_dir_str));
set_current_dir(&workspace_dir)?; set_current_dir(&workspace_dir)?;
// Disable styling for stdout and stderr since // Disable styling for stdout and stderr since