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
d14366c3
Commit
d14366c3
authored
Jun 23, 2016
by
Niels
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/issue269' into develop
parents
6f76c923
7cff6c87
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
README.md
README.md
+4
-0
json.hpp
src/json.hpp
+4
-1
json.hpp.re2c
src/json.hpp.re2c
+4
-1
unit.cpp
test/src/unit.cpp
+9
-0
No files found.
README.md
View file @
d14366c3
...
...
@@ -502,7 +502,11 @@ $ make
$ ./json_unit "
*
"
===============================================================================
<<<<<<< HEAD
All tests passed (5568722 assertions in 32 test cases)
=======
All tests passed (5568721 assertions in 32 test cases)
>>>>>>> develop
```
For more information, have a look at the file
[
.travis.yml
](
https://github.com/nlohmann/json/blob/master/.travis.yml
)
.
src/json.hpp
View file @
d14366c3
...
...
@@ -10002,9 +10002,12 @@ basic_json_parser_63:
// in a second pass, traverse the remaining elements
// remove my remaining elements
const
auto
end_index
=
static_cast
<
difference_type
>
(
result
.
size
());
while
(
i
<
source
.
size
())
{
result
.
push_back
(
object
(
// add operations in reverse order to avoid invalid
// indices
result
.
insert
(
result
.
begin
()
+
end_index
,
object
(
{
{
"op"
,
"remove"
},
{
"path"
,
path
+
"/"
+
std
::
to_string
(
i
)}
...
...
src/json.hpp.re2c
View file @
d14366c3
...
...
@@ -9312,9 +9312,12 @@ class basic_json
// in a second pass, traverse the remaining elements
// remove my remaining elements
const auto end_index = static_cast<difference_type>(result.size());
while (i < source.size())
{
result.push_back(object(
// add operations in reverse order to avoid invalid
// indices
result.insert(result.begin() + end_index, object(
{
{"op", "remove"},
{"path", path + "/" + std::to_string(i)}
...
...
test/src/unit.cpp
View file @
d14366c3
...
...
@@ -14107,6 +14107,15 @@ TEST_CASE("regression tests")
CHECK
(
data
==
json
({{
"key"
,
"value"
},
{
"key2"
,
"value2"
},
{
"key3"
,
"value3"
}}));
}
SECTION
(
"issue #269 - diff generates incorrect patch when removing multiple array elements"
)
{
json
doc
=
R"( { "arr1": [1, 2, 3, 4] } )"
_json
;
json
expected
=
R"( { "arr1": [1, 2] } )"
_json
;
// check roundtrip
CHECK
(
doc
.
patch
(
json
::
diff
(
doc
,
expected
))
==
expected
);
}
}
// special test case to check if memory is leaked if constructor throws
...
...
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