Skip to content

Commit

Permalink
feat: add test for extract
Browse files Browse the repository at this point in the history
  • Loading branch information
juev committed Dec 10, 2023
1 parent e2b2820 commit c0abcb6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions helpers_test.go
@@ -1,6 +1,7 @@
package gobrew

import (
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -135,3 +136,35 @@ func TestExtractMajorVersion(t *testing.T) {
})
}
}

func TestGoBrew_extract(t *testing.T) {
t.Parallel()
type args struct {
srcTar string
dstDir string
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "arhive.tar.gz",
args: args{
srcTar: "testdata/archive.tar.gz",
dstDir: "tmp",
},
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
gb := NewGoBrew(t.TempDir())
if err := gb.extract(tt.args.srcTar, filepath.Join(t.TempDir(), tt.args.dstDir)); (err != nil) != tt.wantErr {
t.Errorf("GoBrew.extract() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
Binary file added testdata/archive.tar.gz
Binary file not shown.

0 comments on commit c0abcb6

Please sign in to comment.