mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-12 08:23:58 +02:00
24 lines
410 B
Go
24 lines
410 B
Go
package url
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestFormat(t *testing.T) {
|
|
testCases := []struct {
|
|
contentType string
|
|
format string
|
|
}{
|
|
{"application/json", "json"},
|
|
{"application/xml", "xml"},
|
|
{"application/json", "json"},
|
|
}
|
|
|
|
for _, c := range testCases {
|
|
f := format(c.contentType)
|
|
if f != c.format {
|
|
t.Fatalf("failed to format %s: expected %s got %s", c.contentType, c.format, f)
|
|
}
|
|
}
|
|
}
|