Merge branch 'develop' into iterator_arithmetic

This commit is contained in:
HenryLee 2017-06-05 20:24:21 +10:00
commit fb91aa81da
3 changed files with 30 additions and 7 deletions

View file

@ -711,6 +711,7 @@ TEST_CASE("regression tests")
"[json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input");
}
/*
SECTION("second example from #529")
{
std::string str = "{\n\"one\" : 1,\n\"two\" : 2\n}\n{\n\"three\" : 3\n}";
@ -748,6 +749,7 @@ TEST_CASE("regression tests")
std::remove("test.json");
}
*/
}
SECTION("issue #389 - Integer-overflow (OSS-Fuzz issue 267)")
@ -1167,4 +1169,10 @@ TEST_CASE("regression tests")
std::vector<uint8_t> vec = {'"', '\\', '"', 'X', '"', '"'};
CHECK_THROWS_AS(json::parse(vec), json::parse_error);
}
SECTION("issue #602 - BOM not skipped when using json:parse(iterator)")
{
std::string i = "\xef\xbb\xbf{\n \"foo\": true\n}";
CHECK_NOTHROW(json::parse(i.begin(), i.end()));
}
}

View file

@ -1012,10 +1012,19 @@ TEST_CASE("Unicode", "[hide]")
SECTION("ignore byte-order-mark")
{
// read a file with a UTF-8 BOM
std::ifstream f("test/data/json_nlohmann_tests/bom.json");
json j;
CHECK_NOTHROW(f >> j);
SECTION("in a stream")
{
// read a file with a UTF-8 BOM
std::ifstream f("test/data/json_nlohmann_tests/bom.json");
json j;
CHECK_NOTHROW(f >> j);
}
SECTION("with an iterator")
{
std::string i = "\xef\xbb\xbf{\n \"foo\": true\n}";
CHECK_NOTHROW(json::parse(i.begin(), i.end()));
}
}
SECTION("error for incomplete/wrong BOM")