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