diff --git a/cli/src/cmd/build.rs b/cli/src/cmd/build.rs index 32ceb98a15ad..11f50cc9e0f8 100644 --- a/cli/src/cmd/build.rs +++ b/cli/src/cmd/build.rs @@ -163,7 +163,7 @@ impl Provider for BuildArgs { } if self.no_auto_detect { - dict.insert("auto_detect_solc".to_string(), self.no_auto_detect.into()); + dict.insert("auto_detect_solc".to_string(), false.into()); } if self.force { diff --git a/cli/tests/cmd.rs b/cli/tests/cmd.rs index 4a06f95a1068..413eb0d455cb 100644 --- a/cli/tests/cmd.rs +++ b/cli/tests/cmd.rs @@ -181,6 +181,21 @@ forgetest_init!(can_override_config, |prj: TestProject, mut cmd: TestCommand| { pretty_eq!(expected.trim().to_string(), cmd.stdout().trim().to_string()); }); +forgetest_init!(can_detect_config_vals, |prj: TestProject, mut cmd: TestCommand| { + cmd.set_current_dir(prj.root()); + + let config = prj.config_from_output(["--no-auto-detect"]); + assert!(!config.auto_detect_solc); + + let mut config = Config::load_with_root(prj.root()); + + config.auto_detect_solc = false; + // write to `foundry.toml` + prj.create_file(Config::FILE_NAME, &config.to_string_pretty().unwrap()); + let config = prj.config_from_output(["--force"]); + assert!(!config.auto_detect_solc); +}); + // checks that `clean` removes dapptools style paths forgetest_init!(can_get_evm_opts, |prj: TestProject, mut cmd: TestCommand| { cmd.set_current_dir(prj.root());