-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml_test.go
More file actions
47 lines (41 loc) · 835 Bytes
/
html_test.go
File metadata and controls
47 lines (41 loc) · 835 Bytes
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
package fiputil
import "testing"
func TestHtmlEscape(t *testing.T) {
input := `abcd&cdef`
output := HtmlEscape([]byte(input))
s := string(output)
if s != `abcd&cdef` {
t.Log(s)
t.FailNow()
}
input = `abcd&cd<ef`
output = HtmlEscape([]byte(input))
s = string(output)
if s != `abcd&cd<ef` {
t.Log(s)
t.FailNow()
}
input = `abcd©d<ef`
output = HtmlEscape([]byte(input))
s = string(output)
if s != `abcd©d<ef` {
t.Log(s)
t.FailNow()
}
}
func TestHtmlEscapeLiterally(t *testing.T) {
input := `abcd&cdef`
output := HtmlEscapeLiterally([]byte(input))
s := string(output)
if s != `abcd&cdef` {
t.Log(s)
t.FailNow()
}
input = `abcd©d<ef`
output = HtmlEscapeLiterally([]byte(input))
s = string(output)
if s != `abcd&copy;d<ef` {
t.Log(s)
t.FailNow()
}
}