Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5fb04bac0a
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (28 sloc) 0.716 kb
package revel
import (
"path"
"path/filepath"
"testing"
)
func TestContentTypeByFilename(t *testing.T) {
testCases := map[string]string{
"xyz.jpg": "image/jpeg",
"helloworld.c": "text/x-c; charset=utf-8",
"helloworld.": "application/octet-stream",
"helloworld": "application/octet-stream",
"hello.world.c": "text/x-c; charset=utf-8",
}
srcPath, _ := findSrcPaths(REVEL_IMPORT_PATH)
ConfPaths = []string{path.Join(
srcPath,
filepath.FromSlash(REVEL_IMPORT_PATH),
"conf"),
}
loadMimeConfig()
for filename, expected := range testCases {
actual := ContentTypeByFilename(filename)
if actual != expected {
t.Errorf("%s: %s, Expected %s", filename, actual, expected)
}
}
}
Jump to Line
Something went wrong with that request. Please try again.