mirror of
https://github.com/golang/go
synced 2024-11-26 06:57:56 -07:00
applied suggestions to TestMimeExtensions
This commit is contained in:
parent
b41e88d296
commit
37f7999e5f
@ -7,6 +7,7 @@
|
|||||||
package mime
|
package mime
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,12 +48,22 @@ func TestTypeByExtensionUNIX(t *testing.T) {
|
|||||||
|
|
||||||
func TestMimeExtension(t *testing.T) {
|
func TestMimeExtension(t *testing.T) {
|
||||||
initMimeUnixTest(t)
|
initMimeUnixTest(t)
|
||||||
exts, _ := ExtensionsByType("example/glob-range")
|
|
||||||
expected := []string{".foo1", ".foo2", ".foo3"}
|
|
||||||
|
|
||||||
for i := range exts {
|
tests := []struct {
|
||||||
if exts[i] != expected[i] {
|
typ string
|
||||||
t.Errorf("Want %q, got %q", expected[i], exts[i])
|
want []string
|
||||||
|
}{
|
||||||
|
{typ: "example/glob-range", want: []string{".foo1", ".foo2", ".foo3"}},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
got, err := ExtensionsByType(tt.typ)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("ExtensionsByType(%q): %v", tt.typ, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(got, tt.want) {
|
||||||
|
t.Errorf("ExtensionsByType(%q) = %q; want %q", tt.typ, got, tt.want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user