Skip to content

Commit 1cdbfc8

Browse files
committed
Add fmt immutability tests
1 parent cfd478b commit 1cdbfc8

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

benches/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl BenchmarkProject {
139139

140140
// Clone the repository
141141
let repo_url = format!("https://github.com/{}/{}.git", config.org, config.repo);
142-
clone_remote(&repo_url, root);
142+
clone_remote(&repo_url, root, true);
143143

144144
// Checkout specific revision if provided
145145
if !config.rev.is_empty() && config.rev != "main" && config.rev != "master" {

crates/forge/tests/cli/install.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ Compiler run successful!
450450
async fn uni_v4_core_sync_foundry_lock() {
451451
let (prj, mut cmd) =
452452
ExtTester::new("Uniswap", "v4-core", "e50237c43811bd9b526eff40f26772152a42daba")
453-
.setup_forge_prj();
453+
.setup_forge_prj(true);
454454

455455
assert!(!prj.root().join(FOUNDRY_LOCK).exists());
456456

@@ -504,7 +504,7 @@ async fn oz_contracts_sync_foundry_lock() {
504504
"openzeppelin-contracts",
505505
"840c974028316f3c8172c1b8e5ed67ad95e255ca",
506506
)
507-
.setup_forge_prj();
507+
.setup_forge_prj(true);
508508

509509
assert!(!prj.root().join(FOUNDRY_LOCK).exists());
510510

@@ -561,7 +561,7 @@ async fn correctly_sync_dep_with_multiple_version() {
561561
"sync-lockfile-multi-version-dep",
562562
"1ca47e73a168e54f8f7761862dbd0c603856c5c8",
563563
)
564-
.setup_forge_prj();
564+
.setup_forge_prj(true);
565565

566566
assert!(!prj.root().join(FOUNDRY_LOCK).exists());
567567

crates/forge/tests/cli/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ mod version;
3434

3535
mod ext_integration;
3636
mod fmt;
37+
mod fmt_integration;
3738
mod test_optimizer;

crates/test-utils/src/util.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl ExtTester {
147147
self
148148
}
149149

150-
pub fn setup_forge_prj(&self) -> (TestProject, TestCommand) {
150+
pub fn setup_forge_prj(&self, recursive: bool) -> (TestProject, TestCommand) {
151151
let (prj, mut test_cmd) = setup_forge(self.name, self.style.clone());
152152

153153
// Export vyper and forge in test command - workaround for snekmate venom tests.
@@ -170,7 +170,7 @@ impl ExtTester {
170170
// Clone the external repository.
171171
let repo_url = format!("https://github.com/{}/{}.git", self.org, self.name);
172172
let root = prj.root().to_str().unwrap();
173-
clone_remote(&repo_url, root);
173+
clone_remote(&repo_url, root, recursive);
174174

175175
// Checkout the revision.
176176
if self.rev.is_empty() {
@@ -224,7 +224,7 @@ impl ExtTester {
224224
return;
225225
}
226226

227-
let (prj, mut test_cmd) = self.setup_forge_prj();
227+
let (prj, mut test_cmd) = self.setup_forge_prj(true);
228228

229229
// Run installation command.
230230
self.run_install_commands(prj.root().to_str().unwrap());
@@ -423,9 +423,14 @@ pub fn get_vyper() -> Vyper {
423423
}
424424

425425
/// Clones a remote repository into the specified directory. Panics if the command fails.
426-
pub fn clone_remote(repo_url: &str, target_dir: &str) {
426+
pub fn clone_remote(repo_url: &str, target_dir: &str, recursive: bool) {
427427
let mut cmd = Command::new("git");
428-
cmd.args(["clone", "--recursive", "--shallow-submodules"]);
428+
cmd.args(["clone"]);
429+
if recursive {
430+
cmd.args(["--recursive", "--shallow-submodules"]);
431+
} else {
432+
cmd.args(["--depth", "1", "--no-recurse-submodules"]);
433+
}
429434
cmd.args([repo_url, target_dir]);
430435
test_debug!("{cmd:?}");
431436
let status = cmd.status().unwrap();

0 commit comments

Comments
 (0)