about summary refs log tree commit diff
path: root/src/tools/rustfmt/check_diff/tests/git.rs
diff options
context:
space:
mode:
authorYacin Tmimi <yacintmimi@gmail.com>2024-09-19 21:46:44 -0400
committerYacin Tmimi <yacintmimi@gmail.com>2024-09-19 21:46:44 -0400
commiteeda9dd07068121961ea4af111dd8060fe58e396 (patch)
tree91b1189c77a5b62b2b039b8260b681cd42c5cb26 /src/tools/rustfmt/check_diff/tests/git.rs
parent506f22b4663f3e756e1e6a4f66c6309fdc00819c (diff)
parentb23b69900eab1260be510b2bd8922f4b6de6cf1e (diff)
downloadrust-eeda9dd07068121961ea4af111dd8060fe58e396.tar.gz
rust-eeda9dd07068121961ea4af111dd8060fe58e396.zip
Merge commit 'b23b69900eab1260be510b2bd8922f4b6de6cf1e' into sync-from-rustfmt
Diffstat (limited to 'src/tools/rustfmt/check_diff/tests/git.rs')
-rw-r--r--src/tools/rustfmt/check_diff/tests/git.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/rustfmt/check_diff/tests/git.rs b/src/tools/rustfmt/check_diff/tests/git.rs
new file mode 100644
index 00000000000..677c3840e1e
--- /dev/null
+++ b/src/tools/rustfmt/check_diff/tests/git.rs
@@ -0,0 +1,16 @@
+use check_diff::clone_git_repo;
+
+use tempfile::Builder;
+
+#[test]
+fn clone_repo_test() {
+    // Creates an empty directory in the current working directory
+    let dir = Builder::new().tempdir_in("").unwrap();
+    let sample_repo = "https://github.com/rust-lang/rustfmt.git";
+    let dest_path = dir.path();
+    let result = clone_git_repo(sample_repo, dest_path);
+    assert!(result.is_ok());
+    // check whether a .git folder exists after cloning the repo
+    let git_repo = dest_path.join(".git");
+    assert!(git_repo.exists());
+}