Commit 2d92fd87 authored by Chris Bednarski's avatar Chris Bednarski

Added test case for gzip that expands the data and compares to what we put in

parent 801e5aaa
package compress
import (
"compress/gzip"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
......@@ -54,6 +56,8 @@ func TestDetectFilename(t *testing.T) {
}
}
const expectedFileContents = "Hello world!"
func TestSimpleCompress(t *testing.T) {
const config = `
{
......@@ -137,10 +141,13 @@ func TestCompressOptions(t *testing.T) {
artifact := testArchive(t, config)
defer artifact.Destroy()
// Verify things look good
_, err := os.Stat("package.gz")
if err != nil {
t.Errorf("Unable to read archive: %s", err)
filename := "package.gz"
archive, _ := os.Open(filename)
gzipReader, _ := gzip.NewReader(archive)
data, _ := ioutil.ReadAll(gzipReader)
if string(data) != expectedFileContents {
t.Errorf("Expected:\n%s\nFound:\n%s\n", expectedFileContents, data)
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment