1
0
mirror of https://github.com/nlohmann/json synced 2024-11-09 22:20:05 +00:00

test case for #269

This commit is contained in:
Niels 2016-06-22 20:40:15 +02:00
parent 59e67e768f
commit ecf84dddb1
2 changed files with 10 additions and 1 deletions

View File

@ -453,7 +453,7 @@ $ make
$ ./json_unit "*"
===============================================================================
All tests passed (5568705 assertions in 31 test cases)
All tests passed (5568722 assertions in 32 test cases)
```
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).

View File

@ -14073,6 +14073,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