summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-02 13:23:25 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-03 13:12:58 +0100
commitd90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch)
tree7b1b14464eefec1188ca2eed53c64e4823453cc9 /media
parent32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff)
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'media')
-rw-r--r--media/mediaType_test.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/media/mediaType_test.go b/media/mediaType_test.go
index ee7d4407a..4526c1e06 100644
--- a/media/mediaType_test.go
+++ b/media/mediaType_test.go
@@ -62,7 +62,6 @@ func TestDefaultTypes(t *testing.T) {
}
c.Assert(len(DefaultTypes), qt.Equals, 26)
-
}
func TestGetByType(t *testing.T) {
@@ -147,13 +146,12 @@ func TestFromExtensionMultipleSuffixes(t *testing.T) {
c.Assert(tp.String(), qt.Equals, "image/svg+xml")
c.Assert(found, qt.Equals, true)
c.Assert(tp.FullSuffix(), qt.Equals, ".svg")
-
}
func TestDecodeTypes(t *testing.T) {
c := qt.New(t)
- var tests = []struct {
+ tests := []struct {
name string
maps []map[string]interface{}
shouldError bool
@@ -164,7 +162,10 @@ func TestDecodeTypes(t *testing.T) {
[]map[string]interface{}{
{
"application/json": map[string]interface{}{
- "suffixes": []string{"jasn"}}}},
+ "suffixes": []string{"jasn"},
+ },
+ },
+ },
false,
func(t *testing.T, name string, tt Types) {
c.Assert(len(tt), qt.Equals, len(DefaultTypes))
@@ -172,7 +173,8 @@ func TestDecodeTypes(t *testing.T) {
c.Assert(found, qt.Equals, true)
c.Assert(json.String(), qt.Equals, "application/json")
c.Assert(json.FullSuffix(), qt.Equals, ".jasn")
- }},
+ },
+ },
{
"MIME suffix in key, multiple file suffixes, custom delimiter",
[]map[string]interface{}{
@@ -180,7 +182,9 @@ func TestDecodeTypes(t *testing.T) {
"application/hugo+hg": map[string]interface{}{
"suffixes": []string{"hg1", "hg2"},
"Delimiter": "_",
- }}},
+ },
+ },
+ },
false,
func(t *testing.T, name string, tt Types) {
c.Assert(len(tt), qt.Equals, len(DefaultTypes)+1)
@@ -193,14 +197,17 @@ func TestDecodeTypes(t *testing.T) {
hg, found = tt.GetByType("application/hugo+hg")
c.Assert(found, qt.Equals, true)
-
- }},
+ },
+ },
{
"Add custom media type",
[]map[string]interface{}{
{
"text/hugo+hgo": map[string]interface{}{
- "Suffixes": []string{"hgo2"}}}},
+ "Suffixes": []string{"hgo2"},
+ },
+ },
+ },
false,
func(t *testing.T, name string, tt Types) {
c.Assert(len(tt), qt.Equals, len(DefaultTypes)+1)
@@ -212,7 +219,8 @@ func TestDecodeTypes(t *testing.T) {
hugo, found := tt.GetBySuffix("hgo2")
c.Assert(found, qt.Equals, true)
c.Assert(hugo.String(), qt.Equals, "text/hugo+hgo")
- }},
+ },
+ },
}
for _, test := range tests {