Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
aa20d262
Commit
aa20d262
authored
Dec 18, 2013
by
Shawn Smith
Committed by
Brad Fitzpatrick
Dec 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoding/json: add test for HTMLEscape
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/38220044
parent
33580e83
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
encode_test.go
src/pkg/encoding/json/encode_test.go
+10
-0
No files found.
src/pkg/encoding/json/encode_test.go
View file @
aa20d262
...
...
@@ -425,3 +425,13 @@ func TestIssue6458(t *testing.T) {
t
.
Errorf
(
"Marshal(x) = %#q; want %#q"
,
b
,
want
)
}
}
func
TestHTMLEscape
(
t
*
testing
.
T
)
{
var
b
,
want
bytes
.
Buffer
m
:=
`{"M":"<html>foo &`
+
"
\xe2\x80\xa8
\xe2\x80\xa9
"
+
`</html>"}`
want
.
Write
([]
byte
(
`{"M":"\u003chtml\u003efoo \u0026\u2028 \u2029\u003c/html\u003e"}`
))
HTMLEscape
(
&
b
,
[]
byte
(
m
))
if
!
bytes
.
Equal
(
b
.
Bytes
(),
want
.
Bytes
())
{
t
.
Errorf
(
"HTMLEscape(&b, []byte(m)) = %s; want %s"
,
b
.
Bytes
(),
want
.
Bytes
())
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment