Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
85500e8c
Commit
85500e8c
authored
Mar 24, 2017
by
Alejandro Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed error code for invalid special ascii chars, fixed writer tests
parent
3c6e2cf0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
12 deletions
+4
-12
reader.h
include/rapidjson/reader.h
+1
-1
writertest.cpp
test/unittest/writertest.cpp
+3
-11
No files found.
include/rapidjson/reader.h
View file @
85500e8c
...
...
@@ -955,7 +955,7 @@ private:
if
(
c
==
'\0'
)
RAPIDJSON_PARSE_ERROR
(
kParseErrorStringMissQuotationMark
,
is
.
Tell
());
else
RAPIDJSON_PARSE_ERROR
(
kParseErrorString
EscapeInvalid
,
is
.
Tell
());
RAPIDJSON_PARSE_ERROR
(
kParseErrorString
InvalidEncoding
,
is
.
Tell
());
}
else
{
size_t
offset
=
is
.
Tell
();
...
...
test/unittest/writertest.cpp
View file @
85500e8c
...
...
@@ -401,16 +401,6 @@ TEST(Writer, InvalidEncoding) {
static
const
UTF32
<>::
Ch
s
[]
=
{
0x110000
,
0
};
// Out of U+0000 to U+10FFFF
EXPECT_FALSE
(
writer
.
String
(
s
));
}
// Fail in decoding invalid ASCII control bytes
{
GenericStringBuffer
<
UTF16
<>
>
buffer
;
Writer
<
GenericStringBuffer
<
UTF16
<>
>
,
UTF8
<>
,
UTF16
<>
>
writer
(
buffer
);
writer
.
StartArray
();
EXPECT_FALSE
(
writer
.
String
(
"
\x01
"
));
EXPECT_FALSE
(
writer
.
String
(
"
\x1C
"
));
writer
.
EndArray
();
}
}
TEST
(
Writer
,
ValidateEncoding
)
{
...
...
@@ -422,8 +412,10 @@ TEST(Writer, ValidateEncoding) {
EXPECT_TRUE
(
writer
.
String
(
"
\xC2\xA2
"
));
// Cents sign U+00A2
EXPECT_TRUE
(
writer
.
String
(
"
\xE2\x82\xAC
"
));
// Euro sign U+20AC
EXPECT_TRUE
(
writer
.
String
(
"
\xF0\x9D\x84\x9E
"
));
// G clef sign U+1D11E
EXPECT_TRUE
(
writer
.
String
(
"
\x01
"
));
// SOH control U+0001
EXPECT_TRUE
(
writer
.
String
(
"
\x1B
"
));
// Escape control U+001B
writer
.
EndArray
();
EXPECT_STREQ
(
"[
\"\x24\"
,
\"\xC2\xA2\"
,
\"\xE2\x82\xAC\"
,
\"\xF0\x9D\x84\x9E\"
]"
,
buffer
.
GetString
());
EXPECT_STREQ
(
"[
\"\x24\"
,
\"\xC2\xA2\"
,
\"\xE2\x82\xAC\"
,
\"\xF0\x9D\x84\x9E\"
,
\"\\
u0001
\"
,
\"\\
u001B
\"
]"
,
buffer
.
GetString
());
}
// Fail in decoding invalid UTF-8 sequence http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
...
...
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