mirror of
https://github.com/nlohmann/json
synced 2024-12-24 17:41:05 +00:00
✅ improved test coverage #1031
This commit is contained in:
parent
16c5bfeaad
commit
6678eb2b4a
@ -62,6 +62,15 @@ TEST_CASE("wide strings")
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("invalid std::wstring")
|
||||
{
|
||||
if (wstring_is_utf16())
|
||||
{
|
||||
std::wstring w = L"\"\xDBFF";
|
||||
CHECK_THROWS_AS(json::parse(w), json::parse_error&);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("std::u16string")
|
||||
{
|
||||
if (u16string_is_utf16())
|
||||
@ -72,6 +81,15 @@ TEST_CASE("wide strings")
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("invalid std::u16string")
|
||||
{
|
||||
if (wstring_is_utf16())
|
||||
{
|
||||
std::u16string w = u"\"\xDBFF";
|
||||
CHECK_THROWS_AS(json::parse(w), json::parse_error&);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("std::u32string")
|
||||
{
|
||||
if (u32string_is_utf32())
|
||||
@ -81,4 +99,13 @@ TEST_CASE("wide strings")
|
||||
CHECK(j.dump() == "[12.2,\"Ⴥaäö💤🧢\"]");
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("invalid std::u32string")
|
||||
{
|
||||
if (u32string_is_utf32())
|
||||
{
|
||||
std::u32string w = U"\"\x110000";
|
||||
CHECK_THROWS_AS(json::parse(w), json::parse_error&);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user