MCPcopy Create free account
hub / github.com/boostorg/json / testUnicodeStrings

Method testUnicodeStrings

test/stream_parser.cpp:1144–1176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1142 }
1143
1144 void
1145 testUnicodeStrings()
1146 {
1147 // Embedded NULL correctly converted
1148 {
1149 auto expected = string_view("Hello\x00World", 11);
1150 {
1151 auto s = string_view(R"json("Hello\u0000World")json");
1152 grind(s);
1153 BOOST_TEST(json::parse(s).as_string() == expected);
1154 }
1155 {
1156 auto s = string_view(R"json(["Hello\u0000World"])json");
1157 grind(s);
1158 BOOST_TEST(json::parse(s).as_array().at(0).as_string() == expected);
1159 }
1160 }
1161
1162 // surrogate pairs correctly converted to UTF-8
1163 {
1164 auto expected = string_view("\xF0\x9D\x84\x9E", 4);
1165 {
1166 auto s = string_view(R"json("\uD834\uDD1E")json");
1167 grind(s);
1168 BOOST_TEST(json::parse(s).as_string() == expected);
1169 }
1170 {
1171 auto s = string_view(R"json(["\uD834\uDD1E"])json");
1172 grind(s);
1173 BOOST_TEST(json::parse(s).as_array().at(0).as_string() == expected);
1174 }
1175 }
1176 }
1177
1178 void
1179 testDupeKeys()

Callers

nothing calls this directly

Calls 1

string_viewClass · 0.85

Tested by

no test coverage detected