MCPcopy Create free account
hub / github.com/github/gh-aw / TestGetCurrentRepoName

Function TestGetCurrentRepoName

pkg/cli/devcontainer_test.go:745–770  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

743}
744
745func TestGetCurrentRepoName(t *testing.T) {
746 tmpDir := testutil.TempDir(t, "test-*")
747
748 originalDir, err := os.Getwd()
749 if err != nil {
750 t.Fatalf("Failed to get current directory: %v", err)
751 }
752 defer func() {
753 _ = os.Chdir(originalDir)
754 }()
755
756 if err := os.Chdir(tmpDir); err != nil {
757 t.Fatalf("Failed to change to temp directory: %v", err)
758 }
759
760 // Initialize git repo
761 if err := exec.Command("git", "init").Run(); err != nil {
762 t.Skip("Git not available")
763 }
764
765 // Get repo name
766 repoName := getCurrentRepoName()
767 if repoName == "" {
768 t.Error("Expected getCurrentRepoName() to return a non-empty string")
769 }
770}

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
getCurrentRepoNameFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected