mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-09-23 12:10:32 -04:00
u8 literal returns a char8_t in C++20
We now use reintepret_cast to cast char8_t's to a const char*, this can be done because char8_t's have the same size and alignment
This commit is contained in:
parent
bd16ebaee8
commit
e9b24028d3
@ -1817,7 +1817,7 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, StaticString) {
|
||||
|
||||
JSONTEST_FIXTURE_LOCAL(ValueTest, WideString) {
|
||||
// https://github.com/open-source-parsers/jsoncpp/issues/756
|
||||
const std::string uni = u8"\u5f0f\uff0c\u8fdb"; // "式,进"
|
||||
const std::string uni = reinterpret_cast<const char*>(u8"\u5f0f\uff0c\u8fdb"); // "式,进"
|
||||
std::string styled;
|
||||
{
|
||||
Json::Value v;
|
||||
@ -2905,8 +2905,8 @@ JSONTEST_FIXTURE_LOCAL(ReaderTest, strictModeParseNumber) {
|
||||
}
|
||||
|
||||
JSONTEST_FIXTURE_LOCAL(ReaderTest, parseChineseWithOneError) {
|
||||
checkParse(R"({ "pr)"
|
||||
u8"\u4f50\u85e4" // 佐藤
|
||||
checkParse(R"({ "pr)" +
|
||||
std::string(reinterpret_cast<const char*>(u8"\u4f50\u85e4")) + // 佐藤
|
||||
R"(erty" :: "value" })",
|
||||
{{18, 19, "Syntax error: value, object or array expected."}},
|
||||
"* Line 1, Column 19\n Syntax error: value, object or array "
|
||||
@ -3008,7 +3008,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
|
||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||
JSONTEST_ASSERT(ok);
|
||||
JSONTEST_ASSERT(errs.empty());
|
||||
JSONTEST_ASSERT_EQUAL(u8"\u8A2a", root[0].asString()); // "訪"
|
||||
JSONTEST_ASSERT_EQUAL((const char*)u8"\u8A2a", root[0].asString()); // "訪"
|
||||
}
|
||||
{
|
||||
char const doc[] = R"([ "\uD801" ])";
|
||||
|
Loading…
x
Reference in New Issue
Block a user