Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix some windows tests #5671

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions crates/forge/tests/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion crates/forge/tests/it/invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Loading