about summary refs log tree commit diff
path: root/src/tools/rustfmt/check_diff/tests/git.rs
blob: 677c3840e1e37749ff94a05f629d76d7754cb0b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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());
}