MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_is_git_repository

Function test_is_git_repository

src/git_operations.rs:613–633  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

611
612 #[tokio::test]
613 async fn test_is_git_repository() {
614 // Test with a directory that is not a git repository
615 let non_git_dir = TestGitRepository::new().unwrap();
616 let is_repo = is_git_repository(non_git_dir.path()).await.unwrap();
617 assert!(!is_repo, "Non-git directory should return false");
618
619 // Test with a valid git repository
620 let git_dir = TestGitRepository::new().unwrap();
621 git_dir.init().unwrap();
622 let is_repo = is_git_repository(git_dir.path()).await.unwrap();
623 assert!(is_repo, "Git repository should return true");
624
625 // Test with a subdirectory inside a git repository
626 let subdir = git_dir.path().join("subdir");
627 std::fs::create_dir(&subdir).unwrap();
628 let is_repo = is_git_repository(&subdir).await.unwrap();
629 assert!(
630 is_repo,
631 "Subdirectory inside git repository should return true"
632 );
633 }
634
635 #[tokio::test]
636 async fn test_git_operations_with_real_repo() {

Callers

nothing calls this directly

Calls 4

is_git_repositoryFunction · 0.85
create_dirFunction · 0.85
pathMethod · 0.80
initMethod · 0.80

Tested by

no test coverage detected