1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00
mycorrhiza/mime_test.go
2020-08-05 20:08:59 +05:00

20 lines
470 B
Go

package main
import (
"testing"
)
func TestMimeData(t *testing.T) {
check := func(ext string, expectedIsText bool, expectedMimeId int) {
isText, mimeId := mimeData(ext)
if isText != expectedIsText || mimeId != expectedMimeId {
t.Error(ext, isText, mimeId)
}
}
check(".txt", true, int(TextPlain))
check(".gmi", true, int(TextGemini))
check(".bin", false, int(BinaryOctet))
check(".jpg", false, int(BinaryJpeg))
check(".bin", false, int(BinaryOctet))
}