From 9c9c8490b38b612b9f3335a5f49ffae6444aa364 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sat, 19 Aug 2023 09:52:43 +0200 Subject: [PATCH] test: fix some windows tests --- crates/forge/tests/cli/config.rs | 15 +++++++++------ crates/forge/tests/it/invariant.rs | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/forge/tests/cli/config.rs b/crates/forge/tests/cli/config.rs index 597f304f7515..e4912732bbcd 100644 --- a/crates/forge/tests/cli/config.rs +++ b/crates/forge/tests/cli/config.rs @@ -223,14 +223,13 @@ forgetest_init!( let profile = Config::load_with_root(prj.root()); // ensure that the auto-generated internal remapping for forge-std's ds-test exists assert_eq!(profile.remappings.len(), 2); - pretty_eq!("ds-test/=lib/forge-std/lib/ds-test/src/", profile.remappings[0].to_string()); + let [r, _] = &profile.remappings[..] else { unreachable!() }; + pretty_eq!("ds-test/=lib/forge-std/lib/ds-test/src/", r.to_string()); - // ensure remappings contain test - pretty_eq!("ds-test/=lib/forge-std/lib/ds-test/src/", profile.remappings[0].to_string()); // the loaded config has resolved, absolute paths pretty_eq!( "ds-test/=lib/forge-std/lib/ds-test/src/", - Remapping::from(profile.remappings[0].clone()).to_string() + Remapping::from(r.clone()).to_string() ); cmd.arg("config"); @@ -250,14 +249,18 @@ forgetest_init!( "solmate/=lib/solmate/src/\nsolmate-contracts/=lib/solmate/src/", ); let config = forge_utils::load_config_with_root(Some(prj.root().into())); + // trailing slashes are removed on windows `to_slash_lossy` + let path = prj.root().join("lib/solmate/src/").to_slash_lossy().into_owned(); + #[cfg(windows)] + let path = path + "/"; pretty_eq!( - format!("solmate/={}", prj.root().join("lib/solmate/src/").to_slash_lossy()), + format!("solmate/={path}"), Remapping::from(config.remappings[0].clone()).to_string() ); // As this is an user-generated remapping, it is not removed, even if it points to the same // location. pretty_eq!( - format!("solmate-contracts/={}", prj.root().join("lib/solmate/src/").to_slash_lossy()), + format!("solmate-contracts/={path}"), Remapping::from(config.remappings[1].clone()).to_string() ); pretty_err(&remappings_txt, fs::remove_file(&remappings_txt)); diff --git a/crates/forge/tests/it/invariant.rs b/crates/forge/tests/it/invariant.rs index 8b50f84acaf0..9b9bde915474 100644 --- a/crates/forge/tests/it/invariant.rs +++ b/crates/forge/tests/it/invariant.rs @@ -114,7 +114,7 @@ async fn test_invariant_storage() { let mut runner = runner().await; let mut opts = test_opts(); - opts.invariant.depth = 100; + opts.invariant.depth = 100 + (50 * cfg!(windows) as u32); opts.fuzz.seed = Some(U256::from(6u32)); runner.test_options = opts.clone();