mirror of
https://github.com/nlohmann/json.git
synced 2025-08-06 19:12:55 +08:00
✅ improve coverage
This commit is contained in:
parent
5ec0980514
commit
33379684b4
@ -58,14 +58,14 @@ class diagnostics_t
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
default: // LCOV_EXCL_LINE
|
||||
break; // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
|
||||
if (tokens.empty())
|
||||
{
|
||||
return "";
|
||||
return ""; // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
|
||||
|
@ -2556,14 +2556,14 @@ class diagnostics_t
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
default: // LCOV_EXCL_LINE
|
||||
break; // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
|
||||
if (tokens.empty())
|
||||
{
|
||||
return "";
|
||||
return ""; // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
|
||||
|
@ -40,6 +40,13 @@ using nlohmann::json;
|
||||
|
||||
TEST_CASE("Better diagnostics")
|
||||
{
|
||||
SECTION("empty JSON Pointer")
|
||||
{
|
||||
json j = 1;
|
||||
std::string s;
|
||||
CHECK_THROWS_WITH_AS(s = j.get<std::string>(), "[json.exception.type_error.302] type must be string, but is number", json::type_error);
|
||||
}
|
||||
|
||||
SECTION("invalid type")
|
||||
{
|
||||
json j;
|
||||
|
Loading…
Reference in New Issue
Block a user