mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
more tests
This commit is contained in:
parent
27363bf44d
commit
b7b464c01f
27
pipeline/archive/tar/tar_test.go
Normal file
27
pipeline/archive/tar/tar_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
package tar
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTarGzFile(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
|
||||
folder, err := ioutil.TempDir("", "targztest")
|
||||
assert.NoError(err)
|
||||
|
||||
file, err := os.Create(folder + "/folder.tar.gz")
|
||||
assert.NoError(err)
|
||||
|
||||
empty, err := os.Create(folder + "/empty.txt")
|
||||
assert.NoError(err)
|
||||
|
||||
archive := New(file)
|
||||
assert.NoError(archive.Add("empty.txt", empty.Name()))
|
||||
assert.Error(archive.Add("dont.txt", empty.Name()+"_nope"))
|
||||
assert.NoError(archive.Close())
|
||||
}
|
27
pipeline/archive/zip/zip_test.go
Normal file
27
pipeline/archive/zip/zip_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
package zip
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestZipFile(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
|
||||
folder, err := ioutil.TempDir("", "ziptest")
|
||||
assert.NoError(err)
|
||||
|
||||
file, err := os.Create(folder + "/folder.zip")
|
||||
assert.NoError(err)
|
||||
|
||||
empty, err := os.Create(folder + "/empty.txt")
|
||||
assert.NoError(err)
|
||||
|
||||
archive := New(file)
|
||||
assert.NoError(archive.Add("empty.txt", empty.Name()))
|
||||
assert.Error(archive.Add("dont.txt", empty.Name()+"_nope"))
|
||||
assert.NoError(archive.Close())
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user