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

Method testParser

test/limits.cpp:237–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235 }
236
237 void
238 testParser()
239 {
240 // string buffer flush
241 {
242 string_view s =
243 "\"\\na\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
244 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
245 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
246 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
247 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
248 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
249 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
250 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
251 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
252 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
253 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
254 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
255 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
256 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
257 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
258 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
259 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
260 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
261 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n"
262 "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"";
263 system::error_code ec;
264 auto jv = parse(s, ec);
265 BOOST_TEST(! ec);
266 }
267 // overflow in on_key_part
268 {
269 system::error_code ec;
270 std::string big;
271 big = "\\b";
272 big += std::string(
273 string::max_size()*2, '*');
274 auto const js =
275 "{\"" + big + "\":null}";
276 auto jv = parse(js, ec);
277 BOOST_TEST(ec == error::key_too_large);
278 BOOST_TEST(ec.has_location());
279 }
280
281 // overflow in on_key
282 {
283 system::error_code ec;
284 std::string big;
285 big = "\\b";
286 big += std::string(
287 (string::max_size()*3)/2, '*');
288 auto const js =
289 "{\"" + big + "\":null}";
290 auto jv = parse(js, ec);
291 BOOST_TEST(ec == error::key_too_large);
292 BOOST_TEST(ec.has_location());
293 }
294

Callers

nothing calls this directly

Calls 1

stringClass · 0.50

Tested by

no test coverage detected