Unit test: properly close image file in test

On Windows it's not allowed to erase a file while it's opened, which caused
this error to surface. The file is now properly closed before the test
file is erased.
This commit is contained in:
Sybren A. Stüvel 2022-06-26 13:22:48 +02:00
parent e687c95e5d
commit 15ad890646

View File

@ -95,6 +95,7 @@ func TestProcessImage(t *testing.T) {
if !assert.NoError(t, err, "thumbnail %s should be openable", spec.filename) {
return
}
defer file.Close()
img, format, err := image.Decode(file)
if !assert.NoErrorf(t, err, "thumbnail %s should be decodable", spec.filename) {