forked from hsiafan/httpdump
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtext_utils_test.go
More file actions
57 lines (53 loc) · 1 KB
/
text_utils_test.go
File metadata and controls
57 lines (53 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import "testing"
func TestParseMimeType(t *testing.T) {
var mimeType = parseMimeType("application/json")
if mimeType.Type != "application" {
t.Fail()
}
if mimeType.subType != "json" {
t.Fail()
}
if !mimeType.isTextContent() {
t.Fail()
}
if mimeType.isBinaryContent() {
t.Fail()
}
}
func TestParseXMimeType(t *testing.T) {
var mimeType = parseMimeType("application/x-msdownload")
if mimeType.Type != "application" {
t.Fail()
}
if mimeType.subType != "msdownload" {
t.Fail()
}
if mimeType.scope != "x" {
t.Fail()
}
if mimeType.isTextContent() {
t.Fail()
}
if !mimeType.isBinaryContent() {
t.Fail()
}
}
func TestVndMimeType(t *testing.T) {
var mimeType = parseMimeType("application/vnd.ms-powerpoint.template.macroenabled.12")
if mimeType.Type != "application" {
t.Fail()
}
if mimeType.subType != "ms-powerpoint" {
t.Fail()
}
if mimeType.scope != "vnd" {
t.Fail()
}
if mimeType.isTextContent() {
t.Fail()
}
if !mimeType.isBinaryContent() {
t.Fail()
}
}