Skip to content

Commit 5436636

Browse files
committed
test: remove redundant mimetype cleanup callbacks
1 parent 8fe2bab commit 5436636

1 file changed

Lines changed: 0 additions & 23 deletions

File tree

validator_test.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6198,31 +6198,27 @@ func TestMIMETypeValidation(t *testing.T) {
61986198
tag string
61996199
expected bool
62006200
createFile func()
6201-
destroyFile func()
62026201
}{
62036202
{
62046203
title: "empty path",
62056204
param: paths["empty"],
62066205
tag: "mimetype=image/png",
62076206
expected: false,
62086207
createFile: func() {},
6209-
destroyFile: func() {},
62106208
},
62116209
{
62126210
title: "directory, not a file",
62136211
param: paths["directory"],
62146212
tag: "mimetype=image/png",
62156213
expected: false,
62166214
createFile: func() {},
6217-
destroyFile: func() {},
62186215
},
62196216
{
62206217
title: "missing file",
62216218
param: paths["missing"],
62226219
tag: "mimetype=image/png",
62236220
expected: false,
62246221
createFile: func() {},
6225-
destroyFile: func() {},
62266222
},
62276223
{
62286224
title: "exact png match",
@@ -6240,10 +6236,6 @@ func TestMIMETypeValidation(t *testing.T) {
62406236
err = png.Encode(f, img)
62416237
Equal(t, err, nil)
62426238
},
6243-
destroyFile: func() {
6244-
err := os.Remove(paths["png"])
6245-
Equal(t, err, nil)
6246-
},
62476239
},
62486240
{
62496241
title: "type wildcard png match",
@@ -6261,10 +6253,6 @@ func TestMIMETypeValidation(t *testing.T) {
62616253
err = png.Encode(f, img)
62626254
Equal(t, err, nil)
62636255
},
6264-
destroyFile: func() {
6265-
err := os.Remove(paths["png"])
6266-
Equal(t, err, nil)
6267-
},
62686256
},
62696257
{
62706258
title: "type wildcard jpeg match",
@@ -6283,18 +6271,13 @@ func TestMIMETypeValidation(t *testing.T) {
62836271
err = jpeg.Encode(f, img, &opt)
62846272
Equal(t, err, nil)
62856273
},
6286-
destroyFile: func() {
6287-
err := os.Remove(paths["jpeg"])
6288-
Equal(t, err, nil)
6289-
},
62906274
},
62916275
{
62926276
title: "type mismatch",
62936277
param: paths["go"],
62946278
tag: "mimetype=image/*",
62956279
expected: false,
62966280
createFile: func() {},
6297-
destroyFile: func() {},
62986281
},
62996282
{
63006283
title: "subtype mismatch",
@@ -6312,18 +6295,13 @@ func TestMIMETypeValidation(t *testing.T) {
63126295
err = png.Encode(f, img)
63136296
Equal(t, err, nil)
63146297
},
6315-
destroyFile: func() {
6316-
err := os.Remove(paths["png"])
6317-
Equal(t, err, nil)
6318-
},
63196298
},
63206299
{
63216300
title: "invalid validator param missing subtype",
63226301
param: paths["go"],
63236302
tag: "mimetype=image",
63246303
expected: false,
63256304
createFile: func() {},
6326-
destroyFile: func() {},
63276305
},
63286306
}
63296307

@@ -6340,7 +6318,6 @@ func TestMIMETypeValidation(t *testing.T) {
63406318
t.Fatalf("Test: '%s' failed Error: %s", test.title, errs)
63416319
}
63426320
}
6343-
test.destroyFile()
63446321
}
63456322

63466323
PanicMatches(t, func() {

0 commit comments

Comments
 (0)