1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-22 15:21:52 +03:00

🐛 parsing erroneous files yields an exception (#366)

This commit is contained in:
Niels Lohmann
2016-11-23 16:57:01 +01:00
parent ed611119d9
commit 4bb41d065b
3 changed files with 18 additions and 0 deletions

View File

@ -495,4 +495,10 @@ TEST_CASE("regression tests")
json j = json::parse("22e2222");
CHECK(j == json());
}
SECTION("issue #366 - json::parse on failed stream gets stuck")
{
std::ifstream f("file_not_found.json");
CHECK_THROWS_AS(json::parse(f), std::invalid_argument);
}
}