1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00

more tests

This commit is contained in:
Carlos Alexandro Becker 2017-03-25 21:45:16 -03:00
parent 27363bf44d
commit b7b464c01f
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 54 additions and 0 deletions

View 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())
}

View 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())
}