improve coverage

parent 5ec09805
...@@ -58,14 +58,14 @@ class diagnostics_t ...@@ -58,14 +58,14 @@ class diagnostics_t
break; break;
} }
default: default: // LCOV_EXCL_LINE
break; break; // LCOV_EXCL_LINE
} }
} }
if (tokens.empty()) if (tokens.empty())
{ {
return ""; return ""; // LCOV_EXCL_LINE
} }
return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{}, return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
......
...@@ -2556,14 +2556,14 @@ class diagnostics_t ...@@ -2556,14 +2556,14 @@ class diagnostics_t
break; break;
} }
default: default: // LCOV_EXCL_LINE
break; break; // LCOV_EXCL_LINE
} }
} }
if (tokens.empty()) if (tokens.empty())
{ {
return ""; return ""; // LCOV_EXCL_LINE
} }
return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{}, return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
......
...@@ -40,6 +40,13 @@ using nlohmann::json; ...@@ -40,6 +40,13 @@ using nlohmann::json;
TEST_CASE("Better diagnostics") 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") SECTION("invalid type")
{ {
json j; json j;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment