authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-29 14:04:31-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-29 14:04:31-04:00
loge3452ba21b978f8b675e90e3b580e325ae0e38a6
treea06a0b321a8b1d78e41e19af27a25f3e50cb14c6
parentda28811c500c8fdc77468013840f978781e9ef7d
signaturelock-open Commit is signed but in an unrecognized format.

json tests do not need this prefix anymore


1 files changed, 319 insertions(+), 319 deletions(-)

std/json/test.zig+319-319
...@@ -21,7 +21,7 @@ fn any(comptime s: []const u8) void {...@@ -21,7 +21,7 @@ fn any(comptime s: []const u8) void {
21//21//
22// Additional tests not part of test JSONTestSuite.22// Additional tests not part of test JSONTestSuite.
2323
24test "json.test.y_trailing_comma_after_empty" {24test "y_trailing_comma_after_empty" {
25 ok(25 ok(
26 \\{"1":[],"2":{},"3":"4"}26 \\{"1":[],"2":{},"3":"4"}
27 );27 );
...@@ -29,252 +29,252 @@ test "json.test.y_trailing_comma_after_empty" {...@@ -29,252 +29,252 @@ test "json.test.y_trailing_comma_after_empty" {
2929
30////////////////////////////////////////////////////////////////////////////////////////////////////30////////////////////////////////////////////////////////////////////////////////////////////////////
3131
32test "json.test.y_array_arraysWithSpaces" {32test "y_array_arraysWithSpaces" {
33 ok(33 ok(
34 \\[[] ]34 \\[[] ]
35 );35 );
36}36}
3737
38test "json.test.y_array_empty" {38test "y_array_empty" {
39 ok(39 ok(
40 \\[]40 \\[]
41 );41 );
42}42}
4343
44test "json.test.y_array_empty-string" {44test "y_array_empty-string" {
45 ok(45 ok(
46 \\[""]46 \\[""]
47 );47 );
48}48}
4949
50test "json.test.y_array_ending_with_newline" {50test "y_array_ending_with_newline" {
51 ok(51 ok(
52 \\["a"]52 \\["a"]
53 );53 );
54}54}
5555
56test "json.test.y_array_false" {56test "y_array_false" {
57 ok(57 ok(
58 \\[false]58 \\[false]
59 );59 );
60}60}
6161
62test "json.test.y_array_heterogeneous" {62test "y_array_heterogeneous" {
63 ok(63 ok(
64 \\[null, 1, "1", {}]64 \\[null, 1, "1", {}]
65 );65 );
66}66}
6767
68test "json.test.y_array_null" {68test "y_array_null" {
69 ok(69 ok(
70 \\[null]70 \\[null]
71 );71 );
72}72}
7373
74test "json.test.y_array_with_1_and_newline" {74test "y_array_with_1_and_newline" {
75 ok(75 ok(
76 \\[176 \\[1
77 \\]77 \\]
78 );78 );
79}79}
8080
81test "json.test.y_array_with_leading_space" {81test "y_array_with_leading_space" {
82 ok(82 ok(
83 \\ [1]83 \\ [1]
84 );84 );
85}85}
8686
87test "json.test.y_array_with_several_null" {87test "y_array_with_several_null" {
88 ok(88 ok(
89 \\[1,null,null,null,2]89 \\[1,null,null,null,2]
90 );90 );
91}91}
9292
93test "json.test.y_array_with_trailing_space" {93test "y_array_with_trailing_space" {
94 ok("[2] ");94 ok("[2] ");
95}95}
9696
97test "json.test.y_number_0e+1" {97test "y_number_0e+1" {
98 ok(98 ok(
99 \\[0e+1]99 \\[0e+1]
100 );100 );
101}101}
102102
103test "json.test.y_number_0e1" {103test "y_number_0e1" {
104 ok(104 ok(
105 \\[0e1]105 \\[0e1]
106 );106 );
107}107}
108108
109test "json.test.y_number_after_space" {109test "y_number_after_space" {
110 ok(110 ok(
111 \\[ 4]111 \\[ 4]
112 );112 );
113}113}
114114
115test "json.test.y_number_double_close_to_zero" {115test "y_number_double_close_to_zero" {
116 ok(116 ok(
117 \\[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001]117 \\[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001]
118 );118 );
119}119}
120120
121test "json.test.y_number_int_with_exp" {121test "y_number_int_with_exp" {
122 ok(122 ok(
123 \\[20e1]123 \\[20e1]
124 );124 );
125}125}
126126
127test "json.test.y_number" {127test "y_number" {
128 ok(128 ok(
129 \\[123e65]129 \\[123e65]
130 );130 );
131}131}
132132
133test "json.test.y_number_minus_zero" {133test "y_number_minus_zero" {
134 ok(134 ok(
135 \\[-0]135 \\[-0]
136 );136 );
137}137}
138138
139test "json.test.y_number_negative_int" {139test "y_number_negative_int" {
140 ok(140 ok(
141 \\[-123]141 \\[-123]
142 );142 );
143}143}
144144
145test "json.test.y_number_negative_one" {145test "y_number_negative_one" {
146 ok(146 ok(
147 \\[-1]147 \\[-1]
148 );148 );
149}149}
150150
151test "json.test.y_number_negative_zero" {151test "y_number_negative_zero" {
152 ok(152 ok(
153 \\[-0]153 \\[-0]
154 );154 );
155}155}
156156
157test "json.test.y_number_real_capital_e" {157test "y_number_real_capital_e" {
158 ok(158 ok(
159 \\[1E22]159 \\[1E22]
160 );160 );
161}161}
162162
163test "json.test.y_number_real_capital_e_neg_exp" {163test "y_number_real_capital_e_neg_exp" {
164 ok(164 ok(
165 \\[1E-2]165 \\[1E-2]
166 );166 );
167}167}
168168
169test "json.test.y_number_real_capital_e_pos_exp" {169test "y_number_real_capital_e_pos_exp" {
170 ok(170 ok(
171 \\[1E+2]171 \\[1E+2]
172 );172 );
173}173}
174174
175test "json.test.y_number_real_exponent" {175test "y_number_real_exponent" {
176 ok(176 ok(
177 \\[123e45]177 \\[123e45]
178 );178 );
179}179}
180180
181test "json.test.y_number_real_fraction_exponent" {181test "y_number_real_fraction_exponent" {
182 ok(182 ok(
183 \\[123.456e78]183 \\[123.456e78]
184 );184 );
185}185}
186186
187test "json.test.y_number_real_neg_exp" {187test "y_number_real_neg_exp" {
188 ok(188 ok(
189 \\[1e-2]189 \\[1e-2]
190 );190 );
191}191}
192192
193test "json.test.y_number_real_pos_exponent" {193test "y_number_real_pos_exponent" {
194 ok(194 ok(
195 \\[1e+2]195 \\[1e+2]
196 );196 );
197}197}
198198
199test "json.test.y_number_simple_int" {199test "y_number_simple_int" {
200 ok(200 ok(
201 \\[123]201 \\[123]
202 );202 );
203}203}
204204
205test "json.test.y_number_simple_real" {205test "y_number_simple_real" {
206 ok(206 ok(
207 \\[123.456789]207 \\[123.456789]
208 );208 );
209}209}
210210
211test "json.test.y_object_basic" {211test "y_object_basic" {
212 ok(212 ok(
213 \\{"asd":"sdf"}213 \\{"asd":"sdf"}
214 );214 );
215}215}
216216
217test "json.test.y_object_duplicated_key_and_value" {217test "y_object_duplicated_key_and_value" {
218 ok(218 ok(
219 \\{"a":"b","a":"b"}219 \\{"a":"b","a":"b"}
220 );220 );
221}221}
222222
223test "json.test.y_object_duplicated_key" {223test "y_object_duplicated_key" {
224 ok(224 ok(
225 \\{"a":"b","a":"c"}225 \\{"a":"b","a":"c"}
226 );226 );
227}227}
228228
229test "json.test.y_object_empty" {229test "y_object_empty" {
230 ok(230 ok(
231 \\{}231 \\{}
232 );232 );
233}233}
234234
235test "json.test.y_object_empty_key" {235test "y_object_empty_key" {
236 ok(236 ok(
237 \\{"":0}237 \\{"":0}
238 );238 );
239}239}
240240
241test "json.test.y_object_escaped_null_in_key" {241test "y_object_escaped_null_in_key" {
242 ok(242 ok(
243 \\{"foo\u0000bar": 42}243 \\{"foo\u0000bar": 42}
244 );244 );
245}245}
246246
247test "json.test.y_object_extreme_numbers" {247test "y_object_extreme_numbers" {
248 ok(248 ok(
249 \\{ "min": -1.0e+28, "max": 1.0e+28 }249 \\{ "min": -1.0e+28, "max": 1.0e+28 }
250 );250 );
251}251}
252252
253test "json.test.y_object" {253test "y_object" {
254 ok(254 ok(
255 \\{"asd":"sdf", "dfg":"fgh"}255 \\{"asd":"sdf", "dfg":"fgh"}
256 );256 );
257}257}
258258
259test "json.test.y_object_long_strings" {259test "y_object_long_strings" {
260 ok(260 ok(
261 \\{"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}261 \\{"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
262 );262 );
263}263}
264264
265test "json.test.y_object_simple" {265test "y_object_simple" {
266 ok(266 ok(
267 \\{"a":[]}267 \\{"a":[]}
268 );268 );
269}269}
270270
271test "json.test.y_object_string_unicode" {271test "y_object_string_unicode" {
272 ok(272 ok(
273 \\{"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" }273 \\{"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" }
274 );274 );
275}275}
276276
277test "json.test.y_object_with_newlines" {277test "y_object_with_newlines" {
278 ok(278 ok(
279 \\{279 \\{
280 \\"a": "b"280 \\"a": "b"
...@@ -282,419 +282,419 @@ test "json.test.y_object_with_newlines" {...@@ -282,419 +282,419 @@ test "json.test.y_object_with_newlines" {
282 );282 );
283}283}
284284
285test "json.test.y_string_1_2_3_bytes_UTF-8_sequences" {285test "y_string_1_2_3_bytes_UTF-8_sequences" {
286 ok(286 ok(
287 \\["\u0060\u012a\u12AB"]287 \\["\u0060\u012a\u12AB"]
288 );288 );
289}289}
290290
291test "json.test.y_string_accepted_surrogate_pair" {291test "y_string_accepted_surrogate_pair" {
292 ok(292 ok(
293 \\["\uD801\udc37"]293 \\["\uD801\udc37"]
294 );294 );
295}295}
296296
297test "json.test.y_string_accepted_surrogate_pairs" {297test "y_string_accepted_surrogate_pairs" {
298 ok(298 ok(
299 \\["\ud83d\ude39\ud83d\udc8d"]299 \\["\ud83d\ude39\ud83d\udc8d"]
300 );300 );
301}301}
302302
303test "json.test.y_string_allowed_escapes" {303test "y_string_allowed_escapes" {
304 ok(304 ok(
305 \\["\"\\\/\b\f\n\r\t"]305 \\["\"\\\/\b\f\n\r\t"]
306 );306 );
307}307}
308308
309test "json.test.y_string_backslash_and_u_escaped_zero" {309test "y_string_backslash_and_u_escaped_zero" {
310 ok(310 ok(
311 \\["\\u0000"]311 \\["\\u0000"]
312 );312 );
313}313}
314314
315test "json.test.y_string_backslash_doublequotes" {315test "y_string_backslash_doublequotes" {
316 ok(316 ok(
317 \\["\""]317 \\["\""]
318 );318 );
319}319}
320320
321test "json.test.y_string_comments" {321test "y_string_comments" {
322 ok(322 ok(
323 \\["a/*b*/c/*d//e"]323 \\["a/*b*/c/*d//e"]
324 );324 );
325}325}
326326
327test "json.test.y_string_double_escape_a" {327test "y_string_double_escape_a" {
328 ok(328 ok(
329 \\["\\a"]329 \\["\\a"]
330 );330 );
331}331}
332332
333test "json.test.y_string_double_escape_n" {333test "y_string_double_escape_n" {
334 ok(334 ok(
335 \\["\\n"]335 \\["\\n"]
336 );336 );
337}337}
338338
339test "json.test.y_string_escaped_control_character" {339test "y_string_escaped_control_character" {
340 ok(340 ok(
341 \\["\u0012"]341 \\["\u0012"]
342 );342 );
343}343}
344344
345test "json.test.y_string_escaped_noncharacter" {345test "y_string_escaped_noncharacter" {
346 ok(346 ok(
347 \\["\uFFFF"]347 \\["\uFFFF"]
348 );348 );
349}349}
350350
351test "json.test.y_string_in_array" {351test "y_string_in_array" {
352 ok(352 ok(
353 \\["asd"]353 \\["asd"]
354 );354 );
355}355}
356356
357test "json.test.y_string_in_array_with_leading_space" {357test "y_string_in_array_with_leading_space" {
358 ok(358 ok(
359 \\[ "asd"]359 \\[ "asd"]
360 );360 );
361}361}
362362
363test "json.test.y_string_last_surrogates_1_and_2" {363test "y_string_last_surrogates_1_and_2" {
364 ok(364 ok(
365 \\["\uDBFF\uDFFF"]365 \\["\uDBFF\uDFFF"]
366 );366 );
367}367}
368368
369test "json.test.y_string_nbsp_uescaped" {369test "y_string_nbsp_uescaped" {
370 ok(370 ok(
371 \\["new\u00A0line"]371 \\["new\u00A0line"]
372 );372 );
373}373}
374374
375test "json.test.y_string_nonCharacterInUTF-8_U+10FFFF" {375test "y_string_nonCharacterInUTF-8_U+10FFFF" {
376 ok(376 ok(
377 \\["􏿿"]377 \\["􏿿"]
378 );378 );
379}379}
380380
381test "json.test.y_string_nonCharacterInUTF-8_U+FFFF" {381test "y_string_nonCharacterInUTF-8_U+FFFF" {
382 ok(382 ok(
383 \\["￿"]383 \\["￿"]
384 );384 );
385}385}
386386
387test "json.test.y_string_null_escape" {387test "y_string_null_escape" {
388 ok(388 ok(
389 \\["\u0000"]389 \\["\u0000"]
390 );390 );
391}391}
392392
393test "json.test.y_string_one-byte-utf-8" {393test "y_string_one-byte-utf-8" {
394 ok(394 ok(
395 \\["\u002c"]395 \\["\u002c"]
396 );396 );
397}397}
398398
399test "json.test.y_string_pi" {399test "y_string_pi" {
400 ok(400 ok(
401 \\["π"]401 \\["π"]
402 );402 );
403}403}
404404
405test "json.test.y_string_reservedCharacterInUTF-8_U+1BFFF" {405test "y_string_reservedCharacterInUTF-8_U+1BFFF" {
406 ok(406 ok(
407 \\["𛿿"]407 \\["𛿿"]
408 );408 );
409}409}
410410
411test "json.test.y_string_simple_ascii" {411test "y_string_simple_ascii" {
412 ok(412 ok(
413 \\["asd "]413 \\["asd "]
414 );414 );
415}415}
416416
417test "json.test.y_string_space" {417test "y_string_space" {
418 ok(418 ok(
419 \\" "419 \\" "
420 );420 );
421}421}
422422
423test "json.test.y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" {423test "y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" {
424 ok(424 ok(
425 \\["\uD834\uDd1e"]425 \\["\uD834\uDd1e"]
426 );426 );
427}427}
428428
429test "json.test.y_string_three-byte-utf-8" {429test "y_string_three-byte-utf-8" {
430 ok(430 ok(
431 \\["\u0821"]431 \\["\u0821"]
432 );432 );
433}433}
434434
435test "json.test.y_string_two-byte-utf-8" {435test "y_string_two-byte-utf-8" {
436 ok(436 ok(
437 \\["\u0123"]437 \\["\u0123"]
438 );438 );
439}439}
440440
441test "json.test.y_string_u+2028_line_sep" {441test "y_string_u+2028_line_sep" {
442 ok("[\"\xe2\x80\xa8\"]");442 ok("[\"\xe2\x80\xa8\"]");
443}443}
444444
445test "json.test.y_string_u+2029_par_sep" {445test "y_string_u+2029_par_sep" {
446 ok("[\"\xe2\x80\xa9\"]");446 ok("[\"\xe2\x80\xa9\"]");
447}447}
448448
449test "json.test.y_string_uescaped_newline" {449test "y_string_uescaped_newline" {
450 ok(450 ok(
451 \\["new\u000Aline"]451 \\["new\u000Aline"]
452 );452 );
453}453}
454454
455test "json.test.y_string_uEscape" {455test "y_string_uEscape" {
456 ok(456 ok(
457 \\["\u0061\u30af\u30EA\u30b9"]457 \\["\u0061\u30af\u30EA\u30b9"]
458 );458 );
459}459}
460460
461test "json.test.y_string_unescaped_char_delete" {461test "y_string_unescaped_char_delete" {
462 ok("[\"\x7f\"]");462 ok("[\"\x7f\"]");
463}463}
464464
465test "json.test.y_string_unicode_2" {465test "y_string_unicode_2" {
466 ok(466 ok(
467 \\["⍂㈴⍂"]467 \\["⍂㈴⍂"]
468 );468 );
469}469}
470470
471test "json.test.y_string_unicodeEscapedBackslash" {471test "y_string_unicodeEscapedBackslash" {
472 ok(472 ok(
473 \\["\u005C"]473 \\["\u005C"]
474 );474 );
475}475}
476476
477test "json.test.y_string_unicode_escaped_double_quote" {477test "y_string_unicode_escaped_double_quote" {
478 ok(478 ok(
479 \\["\u0022"]479 \\["\u0022"]
480 );480 );
481}481}
482482
483test "json.test.y_string_unicode" {483test "y_string_unicode" {
484 ok(484 ok(
485 \\["\uA66D"]485 \\["\uA66D"]
486 );486 );
487}487}
488488
489test "json.test.y_string_unicode_U+10FFFE_nonchar" {489test "y_string_unicode_U+10FFFE_nonchar" {
490 ok(490 ok(
491 \\["\uDBFF\uDFFE"]491 \\["\uDBFF\uDFFE"]
492 );492 );
493}493}
494494
495test "json.test.y_string_unicode_U+1FFFE_nonchar" {495test "y_string_unicode_U+1FFFE_nonchar" {
496 ok(496 ok(
497 \\["\uD83F\uDFFE"]497 \\["\uD83F\uDFFE"]
498 );498 );
499}499}
500500
501test "json.test.y_string_unicode_U+200B_ZERO_WIDTH_SPACE" {501test "y_string_unicode_U+200B_ZERO_WIDTH_SPACE" {
502 ok(502 ok(
503 \\["\u200B"]503 \\["\u200B"]
504 );504 );
505}505}
506506
507test "json.test.y_string_unicode_U+2064_invisible_plus" {507test "y_string_unicode_U+2064_invisible_plus" {
508 ok(508 ok(
509 \\["\u2064"]509 \\["\u2064"]
510 );510 );
511}511}
512512
513test "json.test.y_string_unicode_U+FDD0_nonchar" {513test "y_string_unicode_U+FDD0_nonchar" {
514 ok(514 ok(
515 \\["\uFDD0"]515 \\["\uFDD0"]
516 );516 );
517}517}
518518
519test "json.test.y_string_unicode_U+FFFE_nonchar" {519test "y_string_unicode_U+FFFE_nonchar" {
520 ok(520 ok(
521 \\["\uFFFE"]521 \\["\uFFFE"]
522 );522 );
523}523}
524524
525test "json.test.y_string_utf8" {525test "y_string_utf8" {
526 ok(526 ok(
527 \\["€𝄞"]527 \\["€𝄞"]
528 );528 );
529}529}
530530
531test "json.test.y_string_with_del_character" {531test "y_string_with_del_character" {
532 ok("[\"a\x7fa\"]");532 ok("[\"a\x7fa\"]");
533}533}
534534
535test "json.test.y_structure_lonely_false" {535test "y_structure_lonely_false" {
536 ok(536 ok(
537 \\false537 \\false
538 );538 );
539}539}
540540
541test "json.test.y_structure_lonely_int" {541test "y_structure_lonely_int" {
542 ok(542 ok(
543 \\42543 \\42
544 );544 );
545}545}
546546
547test "json.test.y_structure_lonely_negative_real" {547test "y_structure_lonely_negative_real" {
548 ok(548 ok(
549 \\-0.1549 \\-0.1
550 );550 );
551}551}
552552
553test "json.test.y_structure_lonely_null" {553test "y_structure_lonely_null" {
554 ok(554 ok(
555 \\null555 \\null
556 );556 );
557}557}
558558
559test "json.test.y_structure_lonely_string" {559test "y_structure_lonely_string" {
560 ok(560 ok(
561 \\"asd"561 \\"asd"
562 );562 );
563}563}
564564
565test "json.test.y_structure_lonely_true" {565test "y_structure_lonely_true" {
566 ok(566 ok(
567 \\true567 \\true
568 );568 );
569}569}
570570
571test "json.test.y_structure_string_empty" {571test "y_structure_string_empty" {
572 ok(572 ok(
573 \\""573 \\""
574 );574 );
575}575}
576576
577test "json.test.y_structure_trailing_newline" {577test "y_structure_trailing_newline" {
578 ok(578 ok(
579 \\["a"]579 \\["a"]
580 );580 );
581}581}
582582
583test "json.test.y_structure_true_in_array" {583test "y_structure_true_in_array" {
584 ok(584 ok(
585 \\[true]585 \\[true]
586 );586 );
587}587}
588588
589test "json.test.y_structure_whitespace_array" {589test "y_structure_whitespace_array" {
590 ok(" [] ");590 ok(" [] ");
591}591}
592592
593////////////////////////////////////////////////////////////////////////////////////////////////////593////////////////////////////////////////////////////////////////////////////////////////////////////
594594
595test "json.test.n_array_1_true_without_comma" {595test "n_array_1_true_without_comma" {
596 err(596 err(
597 \\[1 true]597 \\[1 true]
598 );598 );
599}599}
600600
601test "json.test.n_array_a_invalid_utf8" {601test "n_array_a_invalid_utf8" {
602 err(602 err(
603 \\[aå]603 \\[aå]
604 );604 );
605}605}
606606
607test "json.test.n_array_colon_instead_of_comma" {607test "n_array_colon_instead_of_comma" {
608 err(608 err(
609 \\["": 1]609 \\["": 1]
610 );610 );
611}611}
612612
613test "json.test.n_array_comma_after_close" {613test "n_array_comma_after_close" {
614 //err(614 //err(
615 // \\[""],615 // \\[""],
616 //);616 //);
617}617}
618618
619test "json.test.n_array_comma_and_number" {619test "n_array_comma_and_number" {
620 err(620 err(
621 \\[,1]621 \\[,1]
622 );622 );
623}623}
624624
625test "json.test.n_array_double_comma" {625test "n_array_double_comma" {
626 err(626 err(
627 \\[1,,2]627 \\[1,,2]
628 );628 );
629}629}
630630
631test "json.test.n_array_double_extra_comma" {631test "n_array_double_extra_comma" {
632 err(632 err(
633 \\["x",,]633 \\["x",,]
634 );634 );
635}635}
636636
637test "json.test.n_array_extra_close" {637test "n_array_extra_close" {
638 err(638 err(
639 \\["x"]]639 \\["x"]]
640 );640 );
641}641}
642642
643test "json.test.n_array_extra_comma" {643test "n_array_extra_comma" {
644 //err(644 //err(
645 // \\["",]645 // \\["",]
646 //);646 //);
647}647}
648648
649test "json.test.n_array_incomplete_invalid_value" {649test "n_array_incomplete_invalid_value" {
650 err(650 err(
651 \\[x651 \\[x
652 );652 );
653}653}
654654
655test "json.test.n_array_incomplete" {655test "n_array_incomplete" {
656 err(656 err(
657 \\["x"657 \\["x"
658 );658 );
659}659}
660660
661test "json.test.n_array_inner_array_no_comma" {661test "n_array_inner_array_no_comma" {
662 err(662 err(
663 \\[3[4]]663 \\[3[4]]
664 );664 );
665}665}
666666
667test "json.test.n_array_invalid_utf8" {667test "n_array_invalid_utf8" {
668 err(668 err(
669 \\[ÿ]669 \\[ÿ]
670 );670 );
671}671}
672672
673test "json.test.n_array_items_separated_by_semicolon" {673test "n_array_items_separated_by_semicolon" {
674 err(674 err(
675 \\[1:2]675 \\[1:2]
676 );676 );
677}677}
678678
679test "json.test.n_array_just_comma" {679test "n_array_just_comma" {
680 err(680 err(
681 \\[,]681 \\[,]
682 );682 );
683}683}
684684
685test "json.test.n_array_just_minus" {685test "n_array_just_minus" {
686 err(686 err(
687 \\[-]687 \\[-]
688 );688 );
689}689}
690690
691test "json.test.n_array_missing_value" {691test "n_array_missing_value" {
692 err(692 err(
693 \\[ , ""]693 \\[ , ""]
694 );694 );
695}695}
696696
697test "json.test.n_array_newlines_unclosed" {697test "n_array_newlines_unclosed" {
698 err(698 err(
699 \\["a",699 \\["a",
700 \\4700 \\4
...@@ -702,41 +702,41 @@ test "json.test.n_array_newlines_unclosed" {...@@ -702,41 +702,41 @@ test "json.test.n_array_newlines_unclosed" {
702 );702 );
703}703}
704704
705test "json.test.n_array_number_and_comma" {705test "n_array_number_and_comma" {
706 err(706 err(
707 \\[1,]707 \\[1,]
708 );708 );
709}709}
710710
711test "json.test.n_array_number_and_several_commas" {711test "n_array_number_and_several_commas" {
712 err(712 err(
713 \\[1,,]713 \\[1,,]
714 );714 );
715}715}
716716
717test "json.test.n_array_spaces_vertical_tab_formfeed" {717test "n_array_spaces_vertical_tab_formfeed" {
718 err("[\"\x0aa\"\\f]");718 err("[\"\x0aa\"\\f]");
719}719}
720720
721test "json.test.n_array_star_inside" {721test "n_array_star_inside" {
722 err(722 err(
723 \\[*]723 \\[*]
724 );724 );
725}725}
726726
727test "json.test.n_array_unclosed" {727test "n_array_unclosed" {
728 err(728 err(
729 \\[""729 \\[""
730 );730 );
731}731}
732732
733test "json.test.n_array_unclosed_trailing_comma" {733test "n_array_unclosed_trailing_comma" {
734 err(734 err(
735 \\[1,735 \\[1,
736 );736 );
737}737}
738738
739test "json.test.n_array_unclosed_with_new_lines" {739test "n_array_unclosed_with_new_lines" {
740 err(740 err(
741 \\[1,741 \\[1,
742 \\1742 \\1
...@@ -744,956 +744,956 @@ test "json.test.n_array_unclosed_with_new_lines" {...@@ -744,956 +744,956 @@ test "json.test.n_array_unclosed_with_new_lines" {
744 );744 );
745}745}
746746
747test "json.test.n_array_unclosed_with_object_inside" {747test "n_array_unclosed_with_object_inside" {
748 err(748 err(
749 \\[{}749 \\[{}
750 );750 );
751}751}
752752
753test "json.test.n_incomplete_false" {753test "n_incomplete_false" {
754 err(754 err(
755 \\[fals]755 \\[fals]
756 );756 );
757}757}
758758
759test "json.test.n_incomplete_null" {759test "n_incomplete_null" {
760 err(760 err(
761 \\[nul]761 \\[nul]
762 );762 );
763}763}
764764
765test "json.test.n_incomplete_true" {765test "n_incomplete_true" {
766 err(766 err(
767 \\[tru]767 \\[tru]
768 );768 );
769}769}
770770
771test "json.test.n_multidigit_number_then_00" {771test "n_multidigit_number_then_00" {
772 err("123\x00");772 err("123\x00");
773}773}
774774
775test "json.test.n_number_0.1.2" {775test "n_number_0.1.2" {
776 err(776 err(
777 \\[0.1.2]777 \\[0.1.2]
778 );778 );
779}779}
780780
781test "json.test.n_number_-01" {781test "n_number_-01" {
782 err(782 err(
783 \\[-01]783 \\[-01]
784 );784 );
785}785}
786786
787test "json.test.n_number_0.3e" {787test "n_number_0.3e" {
788 err(788 err(
789 \\[0.3e]789 \\[0.3e]
790 );790 );
791}791}
792792
793test "json.test.n_number_0.3e+" {793test "n_number_0.3e+" {
794 err(794 err(
795 \\[0.3e+]795 \\[0.3e+]
796 );796 );
797}797}
798798
799test "json.test.n_number_0_capital_E" {799test "n_number_0_capital_E" {
800 err(800 err(
801 \\[0E]801 \\[0E]
802 );802 );
803}803}
804804
805test "json.test.n_number_0_capital_E+" {805test "n_number_0_capital_E+" {
806 err(806 err(
807 \\[0E+]807 \\[0E+]
808 );808 );
809}809}
810810
811test "json.test.n_number_0.e1" {811test "n_number_0.e1" {
812 err(812 err(
813 \\[0.e1]813 \\[0.e1]
814 );814 );
815}815}
816816
817test "json.test.n_number_0e" {817test "n_number_0e" {
818 err(818 err(
819 \\[0e]819 \\[0e]
820 );820 );
821}821}
822822
823test "json.test.n_number_0e+" {823test "n_number_0e+" {
824 err(824 err(
825 \\[0e+]825 \\[0e+]
826 );826 );
827}827}
828828
829test "json.test.n_number_1_000" {829test "n_number_1_000" {
830 err(830 err(
831 \\[1 000.0]831 \\[1 000.0]
832 );832 );
833}833}
834834
835test "json.test.n_number_1.0e-" {835test "n_number_1.0e-" {
836 err(836 err(
837 \\[1.0e-]837 \\[1.0e-]
838 );838 );
839}839}
840840
841test "json.test.n_number_1.0e" {841test "n_number_1.0e" {
842 err(842 err(
843 \\[1.0e]843 \\[1.0e]
844 );844 );
845}845}
846846
847test "json.test.n_number_1.0e+" {847test "n_number_1.0e+" {
848 err(848 err(
849 \\[1.0e+]849 \\[1.0e+]
850 );850 );
851}851}
852852
853test "json.test.n_number_-1.0." {853test "n_number_-1.0." {
854 err(854 err(
855 \\[-1.0.]855 \\[-1.0.]
856 );856 );
857}857}
858858
859test "json.test.n_number_1eE2" {859test "n_number_1eE2" {
860 err(860 err(
861 \\[1eE2]861 \\[1eE2]
862 );862 );
863}863}
864864
865test "json.test.n_number_.-1" {865test "n_number_.-1" {
866 err(866 err(
867 \\[.-1]867 \\[.-1]
868 );868 );
869}869}
870870
871test "json.test.n_number_+1" {871test "n_number_+1" {
872 err(872 err(
873 \\[+1]873 \\[+1]
874 );874 );
875}875}
876876
877test "json.test.n_number_.2e-3" {877test "n_number_.2e-3" {
878 err(878 err(
879 \\[.2e-3]879 \\[.2e-3]
880 );880 );
881}881}
882882
883test "json.test.n_number_2.e-3" {883test "n_number_2.e-3" {
884 err(884 err(
885 \\[2.e-3]885 \\[2.e-3]
886 );886 );
887}887}
888888
889test "json.test.n_number_2.e+3" {889test "n_number_2.e+3" {
890 err(890 err(
891 \\[2.e+3]891 \\[2.e+3]
892 );892 );
893}893}
894894
895test "json.test.n_number_2.e3" {895test "n_number_2.e3" {
896 err(896 err(
897 \\[2.e3]897 \\[2.e3]
898 );898 );
899}899}
900900
901test "json.test.n_number_-2." {901test "n_number_-2." {
902 err(902 err(
903 \\[-2.]903 \\[-2.]
904 );904 );
905}905}
906906
907test "json.test.n_number_9.e+" {907test "n_number_9.e+" {
908 err(908 err(
909 \\[9.e+]909 \\[9.e+]
910 );910 );
911}911}
912912
913test "json.test.n_number_expression" {913test "n_number_expression" {
914 err(914 err(
915 \\[1+2]915 \\[1+2]
916 );916 );
917}917}
918918
919test "json.test.n_number_hex_1_digit" {919test "n_number_hex_1_digit" {
920 err(920 err(
921 \\[0x1]921 \\[0x1]
922 );922 );
923}923}
924924
925test "json.test.n_number_hex_2_digits" {925test "n_number_hex_2_digits" {
926 err(926 err(
927 \\[0x42]927 \\[0x42]
928 );928 );
929}929}
930930
931test "json.test.n_number_infinity" {931test "n_number_infinity" {
932 err(932 err(
933 \\[Infinity]933 \\[Infinity]
934 );934 );
935}935}
936936
937test "json.test.n_number_+Inf" {937test "n_number_+Inf" {
938 err(938 err(
939 \\[+Inf]939 \\[+Inf]
940 );940 );
941}941}
942942
943test "json.test.n_number_Inf" {943test "n_number_Inf" {
944 err(944 err(
945 \\[Inf]945 \\[Inf]
946 );946 );
947}947}
948948
949test "json.test.n_number_invalid+-" {949test "n_number_invalid+-" {
950 err(950 err(
951 \\[0e+-1]951 \\[0e+-1]
952 );952 );
953}953}
954954
955test "json.test.n_number_invalid-negative-real" {955test "n_number_invalid-negative-real" {
956 err(956 err(
957 \\[-123.123foo]957 \\[-123.123foo]
958 );958 );
959}959}
960960
961test "json.test.n_number_invalid-utf-8-in-bigger-int" {961test "n_number_invalid-utf-8-in-bigger-int" {
962 err(962 err(
963 \\[123å]963 \\[123å]
964 );964 );
965}965}
966966
967test "json.test.n_number_invalid-utf-8-in-exponent" {967test "n_number_invalid-utf-8-in-exponent" {
968 err(968 err(
969 \\[1e1å]969 \\[1e1å]
970 );970 );
971}971}
972972
973test "json.test.n_number_invalid-utf-8-in-int" {973test "n_number_invalid-utf-8-in-int" {
974 err(974 err(
975 \\[0å]975 \\[0å]
976 );976 );
977}977}
978978
979test "json.test.n_number_++" {979test "n_number_++" {
980 err(980 err(
981 \\[++1234]981 \\[++1234]
982 );982 );
983}983}
984984
985test "json.test.n_number_minus_infinity" {985test "n_number_minus_infinity" {
986 err(986 err(
987 \\[-Infinity]987 \\[-Infinity]
988 );988 );
989}989}
990990
991test "json.test.n_number_minus_sign_with_trailing_garbage" {991test "n_number_minus_sign_with_trailing_garbage" {
992 err(992 err(
993 \\[-foo]993 \\[-foo]
994 );994 );
995}995}
996996
997test "json.test.n_number_minus_space_1" {997test "n_number_minus_space_1" {
998 err(998 err(
999 \\[- 1]999 \\[- 1]
1000 );1000 );
1001}1001}
10021002
1003test "json.test.n_number_-NaN" {1003test "n_number_-NaN" {
1004 err(1004 err(
1005 \\[-NaN]1005 \\[-NaN]
1006 );1006 );
1007}1007}
10081008
1009test "json.test.n_number_NaN" {1009test "n_number_NaN" {
1010 err(1010 err(
1011 \\[NaN]1011 \\[NaN]
1012 );1012 );
1013}1013}
10141014
1015test "json.test.n_number_neg_int_starting_with_zero" {1015test "n_number_neg_int_starting_with_zero" {
1016 err(1016 err(
1017 \\[-012]1017 \\[-012]
1018 );1018 );
1019}1019}
10201020
1021test "json.test.n_number_neg_real_without_int_part" {1021test "n_number_neg_real_without_int_part" {
1022 err(1022 err(
1023 \\[-.123]1023 \\[-.123]
1024 );1024 );
1025}1025}
10261026
1027test "json.test.n_number_neg_with_garbage_at_end" {1027test "n_number_neg_with_garbage_at_end" {
1028 err(1028 err(
1029 \\[-1x]1029 \\[-1x]
1030 );1030 );
1031}1031}
10321032
1033test "json.test.n_number_real_garbage_after_e" {1033test "n_number_real_garbage_after_e" {
1034 err(1034 err(
1035 \\[1ea]1035 \\[1ea]
1036 );1036 );
1037}1037}
10381038
1039test "json.test.n_number_real_with_invalid_utf8_after_e" {1039test "n_number_real_with_invalid_utf8_after_e" {
1040 err(1040 err(
1041 \\[1eå]1041 \\[1eå]
1042 );1042 );
1043}1043}
10441044
1045test "json.test.n_number_real_without_fractional_part" {1045test "n_number_real_without_fractional_part" {
1046 err(1046 err(
1047 \\[1.]1047 \\[1.]
1048 );1048 );
1049}1049}
10501050
1051test "json.test.n_number_starting_with_dot" {1051test "n_number_starting_with_dot" {
1052 err(1052 err(
1053 \\[.123]1053 \\[.123]
1054 );1054 );
1055}1055}
10561056
1057test "json.test.n_number_U+FF11_fullwidth_digit_one" {1057test "n_number_U+FF11_fullwidth_digit_one" {
1058 err(1058 err(
1059 \\[1]1059 \\[1]
1060 );1060 );
1061}1061}
10621062
1063test "json.test.n_number_with_alpha_char" {1063test "n_number_with_alpha_char" {
1064 err(1064 err(
1065 \\[1.8011670033376514H-308]1065 \\[1.8011670033376514H-308]
1066 );1066 );
1067}1067}
10681068
1069test "json.test.n_number_with_alpha" {1069test "n_number_with_alpha" {
1070 err(1070 err(
1071 \\[1.2a-3]1071 \\[1.2a-3]
1072 );1072 );
1073}1073}
10741074
1075test "json.test.n_number_with_leading_zero" {1075test "n_number_with_leading_zero" {
1076 err(1076 err(
1077 \\[012]1077 \\[012]
1078 );1078 );
1079}1079}
10801080
1081test "json.test.n_object_bad_value" {1081test "n_object_bad_value" {
1082 err(1082 err(
1083 \\["x", truth]1083 \\["x", truth]
1084 );1084 );
1085}1085}
10861086
1087test "json.test.n_object_bracket_key" {1087test "n_object_bracket_key" {
1088 err(1088 err(
1089 \\{[: "x"}1089 \\{[: "x"}
1090 );1090 );
1091}1091}
10921092
1093test "json.test.n_object_comma_instead_of_colon" {1093test "n_object_comma_instead_of_colon" {
1094 err(1094 err(
1095 \\{"x", null}1095 \\{"x", null}
1096 );1096 );
1097}1097}
10981098
1099test "json.test.n_object_double_colon" {1099test "n_object_double_colon" {
1100 err(1100 err(
1101 \\{"x"::"b"}1101 \\{"x"::"b"}
1102 );1102 );
1103}1103}
11041104
1105test "json.test.n_object_emoji" {1105test "n_object_emoji" {
1106 err(1106 err(
1107 \\{🇨🇭}1107 \\{🇨🇭}
1108 );1108 );
1109}1109}
11101110
1111test "json.test.n_object_garbage_at_end" {1111test "n_object_garbage_at_end" {
1112 err(1112 err(
1113 \\{"a":"a" 123}1113 \\{"a":"a" 123}
1114 );1114 );
1115}1115}
11161116
1117test "json.test.n_object_key_with_single_quotes" {1117test "n_object_key_with_single_quotes" {
1118 err(1118 err(
1119 \\{key: 'value'}1119 \\{key: 'value'}
1120 );1120 );
1121}1121}
11221122
1123test "json.test.n_object_lone_continuation_byte_in_key_and_trailing_comma" {1123test "n_object_lone_continuation_byte_in_key_and_trailing_comma" {
1124 err(1124 err(
1125 \\{"¹":"0",}1125 \\{"¹":"0",}
1126 );1126 );
1127}1127}
11281128
1129test "json.test.n_object_missing_colon" {1129test "n_object_missing_colon" {
1130 err(1130 err(
1131 \\{"a" b}1131 \\{"a" b}
1132 );1132 );
1133}1133}
11341134
1135test "json.test.n_object_missing_key" {1135test "n_object_missing_key" {
1136 err(1136 err(
1137 \\{:"b"}1137 \\{:"b"}
1138 );1138 );
1139}1139}
11401140
1141test "json.test.n_object_missing_semicolon" {1141test "n_object_missing_semicolon" {
1142 err(1142 err(
1143 \\{"a" "b"}1143 \\{"a" "b"}
1144 );1144 );
1145}1145}
11461146
1147test "json.test.n_object_missing_value" {1147test "n_object_missing_value" {
1148 err(1148 err(
1149 \\{"a":1149 \\{"a":
1150 );1150 );
1151}1151}
11521152
1153test "json.test.n_object_no-colon" {1153test "n_object_no-colon" {
1154 err(1154 err(
1155 \\{"a"1155 \\{"a"
1156 );1156 );
1157}1157}
11581158
1159test "json.test.n_object_non_string_key_but_huge_number_instead" {1159test "n_object_non_string_key_but_huge_number_instead" {
1160 err(1160 err(
1161 \\{9999E9999:1}1161 \\{9999E9999:1}
1162 );1162 );
1163}1163}
11641164
1165test "json.test.n_object_non_string_key" {1165test "n_object_non_string_key" {
1166 err(1166 err(
1167 \\{1:1}1167 \\{1:1}
1168 );1168 );
1169}1169}
11701170
1171test "json.test.n_object_repeated_null_null" {1171test "n_object_repeated_null_null" {
1172 err(1172 err(
1173 \\{null:null,null:null}1173 \\{null:null,null:null}
1174 );1174 );
1175}1175}
11761176
1177test "json.test.n_object_several_trailing_commas" {1177test "n_object_several_trailing_commas" {
1178 err(1178 err(
1179 \\{"id":0,,,,,}1179 \\{"id":0,,,,,}
1180 );1180 );
1181}1181}
11821182
1183test "json.test.n_object_single_quote" {1183test "n_object_single_quote" {
1184 err(1184 err(
1185 \\{'a':0}1185 \\{'a':0}
1186 );1186 );
1187}1187}
11881188
1189test "json.test.n_object_trailing_comma" {1189test "n_object_trailing_comma" {
1190 err(1190 err(
1191 \\{"id":0,}1191 \\{"id":0,}
1192 );1192 );
1193}1193}
11941194
1195test "json.test.n_object_trailing_comment" {1195test "n_object_trailing_comment" {
1196 err(1196 err(
1197 \\{"a":"b"}/**/1197 \\{"a":"b"}/**/
1198 );1198 );
1199}1199}
12001200
1201test "json.test.n_object_trailing_comment_open" {1201test "n_object_trailing_comment_open" {
1202 err(1202 err(
1203 \\{"a":"b"}/**//1203 \\{"a":"b"}/**//
1204 );1204 );
1205}1205}
12061206
1207test "json.test.n_object_trailing_comment_slash_open_incomplete" {1207test "n_object_trailing_comment_slash_open_incomplete" {
1208 err(1208 err(
1209 \\{"a":"b"}/1209 \\{"a":"b"}/
1210 );1210 );
1211}1211}
12121212
1213test "json.test.n_object_trailing_comment_slash_open" {1213test "n_object_trailing_comment_slash_open" {
1214 err(1214 err(
1215 \\{"a":"b"}//1215 \\{"a":"b"}//
1216 );1216 );
1217}1217}
12181218
1219test "json.test.n_object_two_commas_in_a_row" {1219test "n_object_two_commas_in_a_row" {
1220 err(1220 err(
1221 \\{"a":"b",,"c":"d"}1221 \\{"a":"b",,"c":"d"}
1222 );1222 );
1223}1223}
12241224
1225test "json.test.n_object_unquoted_key" {1225test "n_object_unquoted_key" {
1226 err(1226 err(
1227 \\{a: "b"}1227 \\{a: "b"}
1228 );1228 );
1229}1229}
12301230
1231test "json.test.n_object_unterminated-value" {1231test "n_object_unterminated-value" {
1232 err(1232 err(
1233 \\{"a":"a1233 \\{"a":"a
1234 );1234 );
1235}1235}
12361236
1237test "json.test.n_object_with_single_string" {1237test "n_object_with_single_string" {
1238 err(1238 err(
1239 \\{ "foo" : "bar", "a" }1239 \\{ "foo" : "bar", "a" }
1240 );1240 );
1241}1241}
12421242
1243test "json.test.n_object_with_trailing_garbage" {1243test "n_object_with_trailing_garbage" {
1244 err(1244 err(
1245 \\{"a":"b"}#1245 \\{"a":"b"}#
1246 );1246 );
1247}1247}
12481248
1249test "json.test.n_single_space" {1249test "n_single_space" {
1250 err(" ");1250 err(" ");
1251}1251}
12521252
1253test "json.test.n_string_1_surrogate_then_escape" {1253test "n_string_1_surrogate_then_escape" {
1254 err(1254 err(
1255 \\["\uD800\"]1255 \\["\uD800\"]
1256 );1256 );
1257}1257}
12581258
1259test "json.test.n_string_1_surrogate_then_escape_u1" {1259test "n_string_1_surrogate_then_escape_u1" {
1260 err(1260 err(
1261 \\["\uD800\u1"]1261 \\["\uD800\u1"]
1262 );1262 );
1263}1263}
12641264
1265test "json.test.n_string_1_surrogate_then_escape_u1x" {1265test "n_string_1_surrogate_then_escape_u1x" {
1266 err(1266 err(
1267 \\["\uD800\u1x"]1267 \\["\uD800\u1x"]
1268 );1268 );
1269}1269}
12701270
1271test "json.test.n_string_1_surrogate_then_escape_u" {1271test "n_string_1_surrogate_then_escape_u" {
1272 err(1272 err(
1273 \\["\uD800\u"]1273 \\["\uD800\u"]
1274 );1274 );
1275}1275}
12761276
1277test "json.test.n_string_accentuated_char_no_quotes" {1277test "n_string_accentuated_char_no_quotes" {
1278 err(1278 err(
1279 \\[é]1279 \\[é]
1280 );1280 );
1281}1281}
12821282
1283test "json.test.n_string_backslash_00" {1283test "n_string_backslash_00" {
1284 err("[\"\x00\"]");1284 err("[\"\x00\"]");
1285}1285}
12861286
1287test "json.test.n_string_escaped_backslash_bad" {1287test "n_string_escaped_backslash_bad" {
1288 err(1288 err(
1289 \\["\\\"]1289 \\["\\\"]
1290 );1290 );
1291}1291}
12921292
1293test "json.test.n_string_escaped_ctrl_char_tab" {1293test "n_string_escaped_ctrl_char_tab" {
1294 err("\x5b\x22\x5c\x09\x22\x5d");1294 err("\x5b\x22\x5c\x09\x22\x5d");
1295}1295}
12961296
1297test "json.test.n_string_escaped_emoji" {1297test "n_string_escaped_emoji" {
1298 err("[\"\x5c\xc3\xb0\xc2\x9f\xc2\x8c\xc2\x80\"]");1298 err("[\"\x5c\xc3\xb0\xc2\x9f\xc2\x8c\xc2\x80\"]");
1299}1299}
13001300
1301test "json.test.n_string_escape_x" {1301test "n_string_escape_x" {
1302 err(1302 err(
1303 \\["\x00"]1303 \\["\x00"]
1304 );1304 );
1305}1305}
13061306
1307test "json.test.n_string_incomplete_escaped_character" {1307test "n_string_incomplete_escaped_character" {
1308 err(1308 err(
1309 \\["\u00A"]1309 \\["\u00A"]
1310 );1310 );
1311}1311}
13121312
1313test "json.test.n_string_incomplete_escape" {1313test "n_string_incomplete_escape" {
1314 err(1314 err(
1315 \\["\"]1315 \\["\"]
1316 );1316 );
1317}1317}
13181318
1319test "json.test.n_string_incomplete_surrogate_escape_invalid" {1319test "n_string_incomplete_surrogate_escape_invalid" {
1320 err(1320 err(
1321 \\["\uD800\uD800\x"]1321 \\["\uD800\uD800\x"]
1322 );1322 );
1323}1323}
13241324
1325test "json.test.n_string_incomplete_surrogate" {1325test "n_string_incomplete_surrogate" {
1326 err(1326 err(
1327 \\["\uD834\uDd"]1327 \\["\uD834\uDd"]
1328 );1328 );
1329}1329}
13301330
1331test "json.test.n_string_invalid_backslash_esc" {1331test "n_string_invalid_backslash_esc" {
1332 err(1332 err(
1333 \\["\a"]1333 \\["\a"]
1334 );1334 );
1335}1335}
13361336
1337test "json.test.n_string_invalid_unicode_escape" {1337test "n_string_invalid_unicode_escape" {
1338 err(1338 err(
1339 \\["\uqqqq"]1339 \\["\uqqqq"]
1340 );1340 );
1341}1341}
13421342
1343test "json.test.n_string_invalid_utf8_after_escape" {1343test "n_string_invalid_utf8_after_escape" {
1344 err("[\"\\\x75\xc3\xa5\"]");1344 err("[\"\\\x75\xc3\xa5\"]");
1345}1345}
13461346
1347test "json.test.n_string_invalid-utf-8-in-escape" {1347test "n_string_invalid-utf-8-in-escape" {
1348 err(1348 err(
1349 \\["\uå"]1349 \\["\uå"]
1350 );1350 );
1351}1351}
13521352
1353test "json.test.n_string_leading_uescaped_thinspace" {1353test "n_string_leading_uescaped_thinspace" {
1354 err(1354 err(
1355 \\[\u0020"asd"]1355 \\[\u0020"asd"]
1356 );1356 );
1357}1357}
13581358
1359test "json.test.n_string_no_quotes_with_bad_escape" {1359test "n_string_no_quotes_with_bad_escape" {
1360 err(1360 err(
1361 \\[\n]1361 \\[\n]
1362 );1362 );
1363}1363}
13641364
1365test "json.test.n_string_single_doublequote" {1365test "n_string_single_doublequote" {
1366 err(1366 err(
1367 \\"1367 \\"
1368 );1368 );
1369}1369}
13701370
1371test "json.test.n_string_single_quote" {1371test "n_string_single_quote" {
1372 err(1372 err(
1373 \\['single quote']1373 \\['single quote']
1374 );1374 );
1375}1375}
13761376
1377test "json.test.n_string_single_string_no_double_quotes" {1377test "n_string_single_string_no_double_quotes" {
1378 err(1378 err(
1379 \\abc1379 \\abc
1380 );1380 );
1381}1381}
13821382
1383test "json.test.n_string_start_escape_unclosed" {1383test "n_string_start_escape_unclosed" {
1384 err(1384 err(
1385 \\["\1385 \\["\
1386 );1386 );
1387}1387}
13881388
1389test "json.test.n_string_unescaped_crtl_char" {1389test "n_string_unescaped_crtl_char" {
1390 err("[\"a\x00a\"]");1390 err("[\"a\x00a\"]");
1391}1391}
13921392
1393test "json.test.n_string_unescaped_newline" {1393test "n_string_unescaped_newline" {
1394 err(1394 err(
1395 \\["new1395 \\["new
1396 \\line"]1396 \\line"]
1397 );1397 );
1398}1398}
13991399
1400test "json.test.n_string_unescaped_tab" {1400test "n_string_unescaped_tab" {
1401 err("[\"\t\"]");1401 err("[\"\t\"]");
1402}1402}
14031403
1404test "json.test.n_string_unicode_CapitalU" {1404test "n_string_unicode_CapitalU" {
1405 err(1405 err(
1406 \\"\UA66D"1406 \\"\UA66D"
1407 );1407 );
1408}1408}
14091409
1410test "json.test.n_string_with_trailing_garbage" {1410test "n_string_with_trailing_garbage" {
1411 err(1411 err(
1412 \\""x1412 \\""x
1413 );1413 );
1414}1414}
14151415
1416test "json.test.n_structure_100000_opening_arrays" {1416test "n_structure_100000_opening_arrays" {
1417 err("[" ** 100000);1417 err("[" ** 100000);
1418}1418}
14191419
1420test "json.test.n_structure_angle_bracket_." {1420test "n_structure_angle_bracket_." {
1421 err(1421 err(
1422 \\<.>1422 \\<.>
1423 );1423 );
1424}1424}
14251425
1426test "json.test.n_structure_angle_bracket_null" {1426test "n_structure_angle_bracket_null" {
1427 err(1427 err(
1428 \\[<null>]1428 \\[<null>]
1429 );1429 );
1430}1430}
14311431
1432test "json.test.n_structure_array_trailing_garbage" {1432test "n_structure_array_trailing_garbage" {
1433 err(1433 err(
1434 \\[1]x1434 \\[1]x
1435 );1435 );
1436}1436}
14371437
1438test "json.test.n_structure_array_with_extra_array_close" {1438test "n_structure_array_with_extra_array_close" {
1439 err(1439 err(
1440 \\[1]]1440 \\[1]]
1441 );1441 );
1442}1442}
14431443
1444test "json.test.n_structure_array_with_unclosed_string" {1444test "n_structure_array_with_unclosed_string" {
1445 err(1445 err(
1446 \\["asd]1446 \\["asd]
1447 );1447 );
1448}1448}
14491449
1450test "json.test.n_structure_ascii-unicode-identifier" {1450test "n_structure_ascii-unicode-identifier" {
1451 err(1451 err(
1452 \\aå1452 \\aå
1453 );1453 );
1454}1454}
14551455
1456test "json.test.n_structure_capitalized_True" {1456test "n_structure_capitalized_True" {
1457 err(1457 err(
1458 \\[True]1458 \\[True]
1459 );1459 );
1460}1460}
14611461
1462test "json.test.n_structure_close_unopened_array" {1462test "n_structure_close_unopened_array" {
1463 err(1463 err(
1464 \\1]1464 \\1]
1465 );1465 );
1466}1466}
14671467
1468test "json.test.n_structure_comma_instead_of_closing_brace" {1468test "n_structure_comma_instead_of_closing_brace" {
1469 err(1469 err(
1470 \\{"x": true,1470 \\{"x": true,
1471 );1471 );
1472}1472}
14731473
1474test "json.test.n_structure_double_array" {1474test "n_structure_double_array" {
1475 err(1475 err(
1476 \\[][]1476 \\[][]
1477 );1477 );
1478}1478}
14791479
1480test "json.test.n_structure_end_array" {1480test "n_structure_end_array" {
1481 err(1481 err(
1482 \\]1482 \\]
1483 );1483 );
1484}1484}
14851485
1486test "json.test.n_structure_incomplete_UTF8_BOM" {1486test "n_structure_incomplete_UTF8_BOM" {
1487 err(1487 err(
1488 \\ï»{}1488 \\ï»{}
1489 );1489 );
1490}1490}
14911491
1492test "json.test.n_structure_lone-invalid-utf-8" {1492test "n_structure_lone-invalid-utf-8" {
1493 err(1493 err(
1494 \\å1494 \\å
1495 );1495 );
1496}1496}
14971497
1498test "json.test.n_structure_lone-open-bracket" {1498test "n_structure_lone-open-bracket" {
1499 err(1499 err(
1500 \\[1500 \\[
1501 );1501 );
1502}1502}
15031503
1504test "json.test.n_structure_no_data" {1504test "n_structure_no_data" {
1505 err(1505 err(
1506 \\1506 \\
1507 );1507 );
1508}1508}
15091509
1510test "json.test.n_structure_null-byte-outside-string" {1510test "n_structure_null-byte-outside-string" {
1511 err("[\x00]");1511 err("[\x00]");
1512}1512}
15131513
1514test "json.test.n_structure_number_with_trailing_garbage" {1514test "n_structure_number_with_trailing_garbage" {
1515 err(1515 err(
1516 \\2@1516 \\2@
1517 );1517 );
1518}1518}
15191519
1520test "json.test.n_structure_object_followed_by_closing_object" {1520test "n_structure_object_followed_by_closing_object" {
1521 err(1521 err(
1522 \\{}}1522 \\{}}
1523 );1523 );
1524}1524}
15251525
1526test "json.test.n_structure_object_unclosed_no_value" {1526test "n_structure_object_unclosed_no_value" {
1527 err(1527 err(
1528 \\{"":1528 \\{"":
1529 );1529 );
1530}1530}
15311531
1532test "json.test.n_structure_object_with_comment" {1532test "n_structure_object_with_comment" {
1533 err(1533 err(
1534 \\{"a":/*comment*/"b"}1534 \\{"a":/*comment*/"b"}
1535 );1535 );
1536}1536}
15371537
1538test "json.test.n_structure_object_with_trailing_garbage" {1538test "n_structure_object_with_trailing_garbage" {
1539 err(1539 err(
1540 \\{"a": true} "x"1540 \\{"a": true} "x"
1541 );1541 );
1542}1542}
15431543
1544test "json.test.n_structure_open_array_apostrophe" {1544test "n_structure_open_array_apostrophe" {
1545 err(1545 err(
1546 \\['1546 \\['
1547 );1547 );
1548}1548}
15491549
1550test "json.test.n_structure_open_array_comma" {1550test "n_structure_open_array_comma" {
1551 err(1551 err(
1552 \\[,1552 \\[,
1553 );1553 );
1554}1554}
15551555
1556test "json.test.n_structure_open_array_object" {1556test "n_structure_open_array_object" {
1557 err("[{\"\":" ** 50000);1557 err("[{\"\":" ** 50000);
1558}1558}
15591559
1560test "json.test.n_structure_open_array_open_object" {1560test "n_structure_open_array_open_object" {
1561 err(1561 err(
1562 \\[{1562 \\[{
1563 );1563 );
1564}1564}
15651565
1566test "json.test.n_structure_open_array_open_string" {1566test "n_structure_open_array_open_string" {
1567 err(1567 err(
1568 \\["a1568 \\["a
1569 );1569 );
1570}1570}
15711571
1572test "json.test.n_structure_open_array_string" {1572test "n_structure_open_array_string" {
1573 err(1573 err(
1574 \\["a"1574 \\["a"
1575 );1575 );
1576}1576}
15771577
1578test "json.test.n_structure_open_object_close_array" {1578test "n_structure_open_object_close_array" {
1579 err(1579 err(
1580 \\{]1580 \\{]
1581 );1581 );
1582}1582}
15831583
1584test "json.test.n_structure_open_object_comma" {1584test "n_structure_open_object_comma" {
1585 err(1585 err(
1586 \\{,1586 \\{,
1587 );1587 );
1588}1588}
15891589
1590test "json.test.n_structure_open_object" {1590test "n_structure_open_object" {
1591 err(1591 err(
1592 \\{1592 \\{
1593 );1593 );
1594}1594}
15951595
1596test "json.test.n_structure_open_object_open_array" {1596test "n_structure_open_object_open_array" {
1597 err(1597 err(
1598 \\{[1598 \\{[
1599 );1599 );
1600}1600}
16011601
1602test "json.test.n_structure_open_object_open_string" {1602test "n_structure_open_object_open_string" {
1603 err(1603 err(
1604 \\{"a1604 \\{"a
1605 );1605 );
1606}1606}
16071607
1608test "json.test.n_structure_open_object_string_with_apostrophes" {1608test "n_structure_open_object_string_with_apostrophes" {
1609 err(1609 err(
1610 \\{'a'1610 \\{'a'
1611 );1611 );
1612}1612}
16131613
1614test "json.test.n_structure_open_open" {1614test "n_structure_open_open" {
1615 err(1615 err(
1616 \\["\{["\{["\{["\{1616 \\["\{["\{["\{["\{
1617 );1617 );
1618}1618}
16191619
1620test "json.test.n_structure_single_eacute" {1620test "n_structure_single_eacute" {
1621 err(1621 err(
1622 \\é1622 \\é
1623 );1623 );
1624}1624}
16251625
1626test "json.test.n_structure_single_star" {1626test "n_structure_single_star" {
1627 err(1627 err(
1628 \\*1628 \\*
1629 );1629 );
1630}1630}
16311631
1632test "json.test.n_structure_trailing_#" {1632test "n_structure_trailing_#" {
1633 err(1633 err(
1634 \\{"a":"b"}#{}1634 \\{"a":"b"}#{}
1635 );1635 );
1636}1636}
16371637
1638test "json.test.n_structure_U+2060_word_joined" {1638test "n_structure_U+2060_word_joined" {
1639 err(1639 err(
1640 \\[⁠]1640 \\[⁠]
1641 );1641 );
1642}1642}
16431643
1644test "json.test.n_structure_uescaped_LF_before_string" {1644test "n_structure_uescaped_LF_before_string" {
1645 err(1645 err(
1646 \\[\u000A""]1646 \\[\u000A""]
1647 );1647 );
1648}1648}
16491649
1650test "json.test.n_structure_unclosed_array" {1650test "n_structure_unclosed_array" {
1651 err(1651 err(
1652 \\[11652 \\[1
1653 );1653 );
1654}1654}
16551655
1656test "json.test.n_structure_unclosed_array_partial_null" {1656test "n_structure_unclosed_array_partial_null" {
1657 err(1657 err(
1658 \\[ false, nul1658 \\[ false, nul
1659 );1659 );
1660}1660}
16611661
1662test "json.test.n_structure_unclosed_array_unfinished_false" {1662test "n_structure_unclosed_array_unfinished_false" {
1663 err(1663 err(
1664 \\[ true, fals1664 \\[ true, fals
1665 );1665 );
1666}1666}
16671667
1668test "json.test.n_structure_unclosed_array_unfinished_true" {1668test "n_structure_unclosed_array_unfinished_true" {
1669 err(1669 err(
1670 \\[ false, tru1670 \\[ false, tru
1671 );1671 );
1672}1672}
16731673
1674test "json.test.n_structure_unclosed_object" {1674test "n_structure_unclosed_object" {
1675 err(1675 err(
1676 \\{"asd":"asd"1676 \\{"asd":"asd"
1677 );1677 );
1678}1678}
16791679
1680test "json.test.n_structure_unicode-identifier" {1680test "n_structure_unicode-identifier" {
1681 err(1681 err(
1682 \\Ã¥1682 \\Ã¥
1683 );1683 );
1684}1684}
16851685
1686test "json.test.n_structure_UTF8_BOM_no_data" {1686test "n_structure_UTF8_BOM_no_data" {
1687 err(1687 err(
1688 \\1688 \\
1689 );1689 );
1690}1690}
16911691
1692test "json.test.n_structure_whitespace_formfeed" {1692test "n_structure_whitespace_formfeed" {
1693 err("[\x0c]");1693 err("[\x0c]");
1694}1694}
16951695
1696test "json.test.n_structure_whitespace_U+2060_word_joiner" {1696test "n_structure_whitespace_U+2060_word_joiner" {
1697 err(1697 err(
1698 \\[⁠]1698 \\[⁠]
1699 );1699 );
...@@ -1701,203 +1701,203 @@ test "json.test.n_structure_whitespace_U+2060_word_joiner" {...@@ -1701,203 +1701,203 @@ test "json.test.n_structure_whitespace_U+2060_word_joiner" {
17011701
1702////////////////////////////////////////////////////////////////////////////////////////////////////1702////////////////////////////////////////////////////////////////////////////////////////////////////
17031703
1704test "json.test.i_number_double_huge_neg_exp" {1704test "i_number_double_huge_neg_exp" {
1705 any(1705 any(
1706 \\[123.456e-789]1706 \\[123.456e-789]
1707 );1707 );
1708}1708}
17091709
1710test "json.test.i_number_huge_exp" {1710test "i_number_huge_exp" {
1711 any(1711 any(
1712 \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]1712 \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]
1713 );1713 );
1714}1714}
17151715
1716test "json.test.i_number_neg_int_huge_exp" {1716test "i_number_neg_int_huge_exp" {
1717 any(1717 any(
1718 \\[-1e+9999]1718 \\[-1e+9999]
1719 );1719 );
1720}1720}
17211721
1722test "json.test.i_number_pos_double_huge_exp" {1722test "i_number_pos_double_huge_exp" {
1723 any(1723 any(
1724 \\[1.5e+9999]1724 \\[1.5e+9999]
1725 );1725 );
1726}1726}
17271727
1728test "json.test.i_number_real_neg_overflow" {1728test "i_number_real_neg_overflow" {
1729 any(1729 any(
1730 \\[-123123e100000]1730 \\[-123123e100000]
1731 );1731 );
1732}1732}
17331733
1734test "json.test.i_number_real_pos_overflow" {1734test "i_number_real_pos_overflow" {
1735 any(1735 any(
1736 \\[123123e100000]1736 \\[123123e100000]
1737 );1737 );
1738}1738}
17391739
1740test "json.test.i_number_real_underflow" {1740test "i_number_real_underflow" {
1741 any(1741 any(
1742 \\[123e-10000000]1742 \\[123e-10000000]
1743 );1743 );
1744}1744}
17451745
1746test "json.test.i_number_too_big_neg_int" {1746test "i_number_too_big_neg_int" {
1747 any(1747 any(
1748 \\[-123123123123123123123123123123]1748 \\[-123123123123123123123123123123]
1749 );1749 );
1750}1750}
17511751
1752test "json.test.i_number_too_big_pos_int" {1752test "i_number_too_big_pos_int" {
1753 any(1753 any(
1754 \\[100000000000000000000]1754 \\[100000000000000000000]
1755 );1755 );
1756}1756}
17571757
1758test "json.test.i_number_very_big_negative_int" {1758test "i_number_very_big_negative_int" {
1759 any(1759 any(
1760 \\[-237462374673276894279832749832423479823246327846]1760 \\[-237462374673276894279832749832423479823246327846]
1761 );1761 );
1762}1762}
17631763
1764test "json.test.i_object_key_lone_2nd_surrogate" {1764test "i_object_key_lone_2nd_surrogate" {
1765 any(1765 any(
1766 \\{"\uDFAA":0}1766 \\{"\uDFAA":0}
1767 );1767 );
1768}1768}
17691769
1770test "json.test.i_string_1st_surrogate_but_2nd_missing" {1770test "i_string_1st_surrogate_but_2nd_missing" {
1771 any(1771 any(
1772 \\["\uDADA"]1772 \\["\uDADA"]
1773 );1773 );
1774}1774}
17751775
1776test "json.test.i_string_1st_valid_surrogate_2nd_invalid" {1776test "i_string_1st_valid_surrogate_2nd_invalid" {
1777 any(1777 any(
1778 \\["\uD888\u1234"]1778 \\["\uD888\u1234"]
1779 );1779 );
1780}1780}
17811781
1782test "json.test.i_string_incomplete_surrogate_and_escape_valid" {1782test "i_string_incomplete_surrogate_and_escape_valid" {
1783 any(1783 any(
1784 \\["\uD800\n"]1784 \\["\uD800\n"]
1785 );1785 );
1786}1786}
17871787
1788test "json.test.i_string_incomplete_surrogate_pair" {1788test "i_string_incomplete_surrogate_pair" {
1789 any(1789 any(
1790 \\["\uDd1ea"]1790 \\["\uDd1ea"]
1791 );1791 );
1792}1792}
17931793
1794test "json.test.i_string_incomplete_surrogates_escape_valid" {1794test "i_string_incomplete_surrogates_escape_valid" {
1795 any(1795 any(
1796 \\["\uD800\uD800\n"]1796 \\["\uD800\uD800\n"]
1797 );1797 );
1798}1798}
17991799
1800test "json.test.i_string_invalid_lonely_surrogate" {1800test "i_string_invalid_lonely_surrogate" {
1801 any(1801 any(
1802 \\["\ud800"]1802 \\["\ud800"]
1803 );1803 );
1804}1804}
18051805
1806test "json.test.i_string_invalid_surrogate" {1806test "i_string_invalid_surrogate" {
1807 any(1807 any(
1808 \\["\ud800abc"]1808 \\["\ud800abc"]
1809 );1809 );
1810}1810}
18111811
1812test "json.test.i_string_invalid_utf-8" {1812test "i_string_invalid_utf-8" {
1813 any(1813 any(
1814 \\["ÿ"]1814 \\["ÿ"]
1815 );1815 );
1816}1816}
18171817
1818test "json.test.i_string_inverted_surrogates_U+1D11E" {1818test "i_string_inverted_surrogates_U+1D11E" {
1819 any(1819 any(
1820 \\["\uDd1e\uD834"]1820 \\["\uDd1e\uD834"]
1821 );1821 );
1822}1822}
18231823
1824test "json.test.i_string_iso_latin_1" {1824test "i_string_iso_latin_1" {
1825 any(1825 any(
1826 \\["é"]1826 \\["é"]
1827 );1827 );
1828}1828}
18291829
1830test "json.test.i_string_lone_second_surrogate" {1830test "i_string_lone_second_surrogate" {
1831 any(1831 any(
1832 \\["\uDFAA"]1832 \\["\uDFAA"]
1833 );1833 );
1834}1834}
18351835
1836test "json.test.i_string_lone_utf8_continuation_byte" {1836test "i_string_lone_utf8_continuation_byte" {
1837 any(1837 any(
1838 \\[""]1838 \\[""]
1839 );1839 );
1840}1840}
18411841
1842test "json.test.i_string_not_in_unicode_range" {1842test "i_string_not_in_unicode_range" {
1843 any(1843 any(
1844 \\["ô¿¿¿"]1844 \\["ô¿¿¿"]
1845 );1845 );
1846}1846}
18471847
1848test "json.test.i_string_overlong_sequence_2_bytes" {1848test "i_string_overlong_sequence_2_bytes" {
1849 any(1849 any(
1850 \\["À¯"]1850 \\["À¯"]
1851 );1851 );
1852}1852}
18531853
1854test "json.test.i_string_overlong_sequence_6_bytes" {1854test "i_string_overlong_sequence_6_bytes" {
1855 any(1855 any(
1856 \\["üƒ¿¿¿¿"]1856 \\["üƒ¿¿¿¿"]
1857 );1857 );
1858}1858}
18591859
1860test "json.test.i_string_overlong_sequence_6_bytes_null" {1860test "i_string_overlong_sequence_6_bytes_null" {
1861 any(1861 any(
1862 \\["ü€€€€€"]1862 \\["ü€€€€€"]
1863 );1863 );
1864}1864}
18651865
1866test "json.test.i_string_truncated-utf-8" {1866test "i_string_truncated-utf-8" {
1867 any(1867 any(
1868 \\["àÿ"]1868 \\["àÿ"]
1869 );1869 );
1870}1870}
18711871
1872test "json.test.i_string_utf16BE_no_BOM" {1872test "i_string_utf16BE_no_BOM" {
1873 any("\x00\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d");1873 any("\x00\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d");
1874}1874}
18751875
1876test "json.test.i_string_utf16LE_no_BOM" {1876test "i_string_utf16LE_no_BOM" {
1877 any("\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");1877 any("\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
1878}1878}
18791879
1880test "json.test.i_string_UTF-16LE_with_BOM" {1880test "i_string_UTF-16LE_with_BOM" {
1881 any("\xc3\xbf\xc3\xbe\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");1881 any("\xc3\xbf\xc3\xbe\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
1882}1882}
18831883
1884test "json.test.i_string_UTF-8_invalid_sequence" {1884test "i_string_UTF-8_invalid_sequence" {
1885 any(1885 any(
1886 \\["日шú"]1886 \\["日шú"]
1887 );1887 );
1888}1888}
18891889
1890test "json.test.i_string_UTF8_surrogate_U+D800" {1890test "i_string_UTF8_surrogate_U+D800" {
1891 any(1891 any(
1892 \\["í €"]1892 \\["í €"]
1893 );1893 );
1894}1894}
18951895
1896test "json.test.i_structure_500_nested_arrays" {1896test "i_structure_500_nested_arrays" {
1897 any(("[" ** 500) ++ ("]" ** 500));1897 any(("[" ** 500) ++ ("]" ** 500));
1898}1898}
18991899
1900test "json.test.i_structure_UTF-8_BOM_empty_object" {1900test "i_structure_UTF-8_BOM_empty_object" {
1901 any(1901 any(
1902 \\{}1902 \\{}
1903 );1903 );