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
d7b032f5
Unverified
Commit
d7b032f5
authored
May 13, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✅
add tests to improve coverage
parent
a414e359
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
binary_reader.hpp
include/nlohmann/detail/input/binary_reader.hpp
+1
-1
binary_writer.hpp
include/nlohmann/detail/output/binary_writer.hpp
+1
-3
json.hpp
single_include/nlohmann/json.hpp
+2
-4
unit-json_pointer.cpp
test/src/unit-json_pointer.cpp
+3
-0
unit-regression.cpp
test/src/unit-regression.cpp
+5
-0
No files found.
include/nlohmann/detail/input/binary_reader.hpp
View file @
d7b032f5
...
...
@@ -1578,7 +1578,7 @@ class binary_reader
}
default
:
// LCOV_EXCL_LINE
assert
(
false
)
;
// LCOV_EXCL_LINE
return
false
;
// LCOV_EXCL_LINE
}
}
...
...
include/nlohmann/detail/output/binary_writer.hpp
View file @
d7b032f5
...
...
@@ -1092,9 +1092,7 @@ class binary_writer
}
write_number
(
subtype
);
oa
->
write_characters
(
reinterpret_cast
<
const
CharType
*>
(
value
.
data
()),
value
.
size
());
oa
->
write_characters
(
reinterpret_cast
<
const
CharType
*>
(
value
.
data
()),
value
.
size
());
}
/*!
...
...
single_include/nlohmann/json.hpp
View file @
d7b032f5
...
...
@@ -7105,7 +7105,7 @@ class binary_reader
}
default
:
// LCOV_EXCL_LINE
assert
(
false
)
;
// LCOV_EXCL_LINE
return
false
;
// LCOV_EXCL_LINE
}
}
...
...
@@ -13041,9 +13041,7 @@ class binary_writer
}
write_number
(
subtype
);
oa
->
write_characters
(
reinterpret_cast
<
const
CharType
*>
(
value
.
data
()),
value
.
size
());
oa
->
write_characters
(
reinterpret_cast
<
const
CharType
*>
(
value
.
data
()),
value
.
size
());
}
/*!
...
...
test/src/unit-json_pointer.cpp
View file @
d7b032f5
...
...
@@ -101,6 +101,9 @@ TEST_CASE("JSON pointers")
CHECK
(
j
[
"/foo/1"
_json_pointer
]
==
j
[
"foo"
][
1
]);
CHECK
(
j
.
contains
(
json
::
json_pointer
(
"/foo/0"
)));
CHECK
(
j
.
contains
(
json
::
json_pointer
(
"/foo/1"
)));
CHECK
(
not
j
.
contains
(
json
::
json_pointer
(
"/foo/3"
)));
CHECK
(
not
j
.
contains
(
json
::
json_pointer
(
"/foo/+"
)));
CHECK
(
not
j
.
contains
(
json
::
json_pointer
(
"/foo/1+2"
)));
CHECK
(
not
j
.
contains
(
json
::
json_pointer
(
"/foo/-"
)));
// checked array access
...
...
test/src/unit-regression.cpp
View file @
d7b032f5
...
...
@@ -464,6 +464,11 @@ TEST_CASE("regression tests")
s2
=
o
[
"name"
];
CHECK
(
s2
==
"value"
);
// improve coverage
o
[
"int"
]
=
1
;
CHECK_THROWS_AS
(
s2
=
o
[
"int"
],
json
::
type_error
);
CHECK_THROWS_WITH
(
s2
=
o
[
"int"
],
"[json.exception.type_error.302] type must be string, but is number"
);
}
SECTION
(
"issue #146 - character following a surrogate pair is skipped"
)
...
...
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