Skip to content

Commit

Permalink
Fix Project tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adambabik committed Nov 18, 2023
1 parent 4d359c4 commit 1864efa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
16 changes: 14 additions & 2 deletions internal/project/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,29 @@ import (
// make ./testdata/git-project a valid git project.
func prepareGitProject() {
dir := testdataGitProject()

cmd := exec.Command("cp", "-fr", filepath.Join(dir, ".git.bkp"), filepath.Join(dir, ".git"))
if output, err := cmd.CombinedOutput(); err != nil {
log.Fatalf("failed to prepare git project: %v; output: %s", err, output)
log.Fatalf("failed to prepare .git: %v; output: %s", err, output)
}

cmd = exec.Command("cp", "-f", filepath.Join(dir, ".gitignore.bkp"), filepath.Join(dir, ".gitignore"))
if output, err := cmd.CombinedOutput(); err != nil {
log.Fatalf("failed to prepare .gitignore: %v; output: %s", err, output)
}
}

func cleanupGitProject() {
dir := testdataGitProject()

cmd := exec.Command("rm", "-rf", filepath.Join(dir, ".git"))
if output, err := cmd.CombinedOutput(); err != nil {
log.Fatalf("failed clean up git project: %v; output: %s", err, output)
log.Fatalf("failed clean up .git: %v; output: %s", err, output)
}

cmd = exec.Command("rm", "-f", filepath.Join(dir, ".gitignore"))
if output, err := cmd.CombinedOutput(); err != nil {
log.Fatalf("failed clean up .gitignore: %v; output: %s", err, output)
}
}

Expand Down
3 changes: 3 additions & 0 deletions internal/project/testdata/git-project/git-ignored.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```sh
echo "git-ignored"
```

0 comments on commit 1864efa

Please sign in to comment.