Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
2f73a4d1
Unverified
Commit
2f73a4d1
authored
Oct 31, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚨
fixed a linter warning
parent
e3c28afb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
binary_reader.hpp
include/nlohmann/detail/input/binary_reader.hpp
+4
-1
json.hpp
single_include/nlohmann/json.hpp
+4
-1
unit-bson.cpp
test/src/unit-bson.cpp
+22
-0
No files found.
include/nlohmann/detail/input/binary_reader.hpp
View file @
2f73a4d1
...
...
@@ -300,7 +300,10 @@ class binary_reader
if
(
not
is_array
)
{
sax
->
key
(
key
);
if
(
not
sax
->
key
(
key
))
{
return
false
;
}
}
if
(
JSON_UNLIKELY
(
not
parse_bson_element_internal
(
element_type
,
element_type_parse_position
)))
...
...
single_include/nlohmann/json.hpp
View file @
2f73a4d1
...
...
@@ -6635,7 +6635,10 @@ class binary_reader
if
(
not
is_array
)
{
sax
->
key
(
key
);
if
(
not
sax
->
key
(
key
))
{
return
false
;
}
}
if
(
JSON_UNLIKELY
(
not
parse_bson_element_internal
(
element_type
,
element_type_parse_position
)))
...
...
test/src/unit-bson.cpp
View file @
2f73a4d1
...
...
@@ -752,6 +752,28 @@ TEST_CASE("Incomplete BSON Input")
SaxCountdown
scp
(
0
);
CHECK
(
not
json
::
sax_parse
(
incomplete_bson
,
&
scp
,
json
::
input_format_t
::
bson
));
}
SECTION
(
"Improve coverage"
)
{
SECTION
(
"key"
)
{
json
j
=
{{
"key"
,
"value"
}};
auto
bson_vec
=
json
::
to_bson
(
j
);
SaxCountdown
scp
(
2
);
CHECK
(
not
json
::
sax_parse
(
bson_vec
,
&
scp
,
json
::
input_format_t
::
bson
));
}
SECTION
(
"array"
)
{
json
j
=
{
{
"entry"
,
json
::
array
()
}
};
auto
bson_vec
=
json
::
to_bson
(
j
);
SaxCountdown
scp
(
2
);
CHECK
(
not
json
::
sax_parse
(
bson_vec
,
&
scp
,
json
::
input_format_t
::
bson
));
}
}
}
TEST_CASE
(
"Unsupported BSON input"
)
...
...
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