Skip to content

Commit b26d2ec

Browse files
fkleonbep
authored andcommitted
Fix test for corrupt files
1 parent ee0de9b commit b26d2ec

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎imagemeta_test.go‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ func TestDecodeTIFF(t *testing.T) {
152152
func TestDecodeCorrupt(t *testing.T) {
153153
c := qt.New(t)
154154

155-
files, err := filepath.Glob(filepath.Join("testdata", "corrupt", "*.*"))
155+
files, err := filepath.Glob(filepath.Join("testdata", "images", "corrupt", "*.*"))
156156
c.Assert(err, qt.IsNil)
157+
c.Assert(files, qt.HasLen, 3)
157158

158159
for _, file := range files {
159160
img, err := os.Open(file)
@@ -163,7 +164,11 @@ func TestDecodeCorrupt(t *testing.T) {
163164
return nil
164165
}
165166
err = imagemeta.Decode(imagemeta.Options{R: img, ImageFormat: format, HandleTag: handleTag, Warnf: panicWarnf})
166-
c.Assert(imagemeta.IsInvalidFormat(err), qt.IsTrue, qt.Commentf("file: %s", file))
167+
168+
if !imagemeta.IsInvalidFormat(err) {
169+
c.Assert(err, qt.ErrorMatches, "UserComment: expected \\[\\]uint8, got string", qt.Commentf("file: %s", file))
170+
}
171+
167172
img.Close()
168173
}
169174
}

0 commit comments

Comments
 (0)