Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
0164b10e
Commit
0164b10e
authored
Jan 29, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✅
added missing tests found by mutate++
parent
affa3bf4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
test/src/unit-class_parser.cpp
test/src/unit-class_parser.cpp
+26
-0
No files found.
test/src/unit-class_parser.cpp
View file @
0164b10e
...
...
@@ -596,6 +596,32 @@ TEST_CASE("parser class")
"missing or wrong low surrogate"
);
}
SECTION
(
"tests found by mutate++"
)
{
// test case to make sure no comma preceeds the first key
CHECK_THROWS_AS
(
json
::
parser
(
"{,
\"
key
\"
: false}"
).
parse
(),
std
::
invalid_argument
);
// test case to make sure an object is properly closed
CHECK_THROWS_AS
(
json
::
parser
(
"[{
\"
key
\"
: false true]"
).
parse
(),
std
::
invalid_argument
);
// test case to make sure the callback is properly evaluated after reading a key
{
json
::
parser_callback_t
cb
=
[](
int
depth
,
json
::
parse_event_t
event
,
json
&
parsed
)
{
if
(
event
==
json
::
parse_event_t
::
key
)
{
return
false
;
}
else
{
return
true
;
}
};
json
x
=
json
::
parse
(
"{
\"
key
\"
: false}"
,
cb
);
CHECK
(
x
==
json
::
object
());
}
}
SECTION
(
"callback function"
)
{
auto
s_object
=
R"(
...
...
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