mirror of
https://github.com/nlohmann/json.git
synced 2026-02-26 13:26:28 +00:00
Added class hierarchy for user-defined exceptions (#244). Integrated parse exceptions 101-103. Parse exceptions include the byte count of the last read character to locate the position of the error (#301).
This commit is contained in:
@@ -190,8 +190,10 @@ TEST_CASE("lexer class")
|
||||
|
||||
SECTION("to_unicode")
|
||||
{
|
||||
CHECK(json::lexer::to_unicode(0x1F4A9) == "💩");
|
||||
CHECK_THROWS_AS(json::lexer::to_unicode(0x200000), std::out_of_range);
|
||||
CHECK_THROWS_WITH(json::lexer::to_unicode(0x200000), "code points above 0x10FFFF are invalid");
|
||||
// lexer to call to_unicode on
|
||||
json::lexer dummy_lexer(reinterpret_cast<const json::lexer::lexer_char_t*>(""), 0);
|
||||
CHECK(dummy_lexer.to_unicode(0x1F4A9) == "💩");
|
||||
CHECK_THROWS_AS(dummy_lexer.to_unicode(0x200000), json::parse_error);
|
||||
CHECK_THROWS_WITH(dummy_lexer.to_unicode(0x200000), "[json.exception.parse_error.103] parse error: code points above 0x10FFFF are invalid");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user