Skip to content

Commit

Permalink
Don't create files during tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aybabtme committed Apr 20, 2014
1 parent 71b4bd2 commit d3b541c
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,15 @@ func TestDecodeEncode(t *testing.T) {

assertDimension(t, resized, "100x100")

dest, _ := os.Create("/tmp/dest.jpg")
defer dest.Close()

var buffer bytes.Buffer

_, err = EncodeJpeg(&buffer, resized)
buf := bytes.NewBuffer(nil)
_, err = EncodeJpeg(buf, resized)

if err != nil {
t.Error(err)
return
}

roundtrip, err := DecodeJpeg(&buffer)
roundtrip, err := DecodeJpeg(buf)
if err != nil {
panic("Couldn't load image: " + err.Error())
}
Expand All @@ -160,9 +156,7 @@ func TestDecodePng(t *testing.T) {
img := asset("image/jpg", "image.jpg")
defer img.Destroy()

dest, _ := os.Create("/tmp/dest.png")
defer dest.Close()

dest := bytes.NewBuffer(nil)
_, err := EncodePng(dest, img)

if err != nil {
Expand All @@ -175,9 +169,7 @@ func TestDecodeGif(t *testing.T) {
img := asset("image/jpg", "image.jpg")
defer img.Destroy()

dest, _ := os.Create("/tmp/dest.gif")
defer dest.Close()

dest := bytes.NewBuffer(nil)
_, err := EncodeGif(dest, img)

if err != nil {
Expand Down

0 comments on commit d3b541c

Please sign in to comment.