Skip to content

Commit

Permalink
refactor main test
Browse files Browse the repository at this point in the history
  • Loading branch information
ybirader committed Sep 10, 2023
1 parent 26c8e3e commit d627536
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions cmd/cli/pzip_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main_test

import (
"log"
"path/filepath"
"testing"

Expand All @@ -16,27 +15,28 @@ const (
)

func TestPzip(t *testing.T) {
if testing.Short() {
t.Skip()
}

binPath, cleanup, err := cli.BuildBinary()
if err != nil {
log.Fatal("ERROR: could not build binary", err)
}
defer cleanup()

absArchivePath, err := filepath.Abs(archivePath)
if err != nil {
t.Fatalf("ERROR: could not get path to archive %s", archivePath)
t.Fatal("ERROR: could not build binary", err)
}

absDirPath, err := filepath.Abs(dirPath)
if err != nil {
t.Fatalf("ERROR: could not get path to directory %s", dirPath)
}

driver := cli.NewDriver(binPath, absArchivePath, absDirPath)

specifications.ArchiveDir(t, driver)
t.Cleanup(cleanup)
t.Run("archives directory", func(t *testing.T) {
if testing.Short() {
t.Skip()
}

absArchivePath, err := filepath.Abs(archivePath)
if err != nil {
t.Fatalf("ERROR: could not get path to archive %s", archivePath)
}

absDirPath, err := filepath.Abs(dirPath)
if err != nil {
t.Fatalf("ERROR: could not get path to directory %s", dirPath)
}

driver := cli.NewDriver(binPath, absArchivePath, absDirPath)

specifications.ArchiveDir(t, driver)
})
}

0 comments on commit d627536

Please sign in to comment.