authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-05-25 02:08:43-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-05-25 02:08:43-04:00
log56cb7f1740bf369b7cd2cac29db559c5c6bccc22
treeac488bb94d4983be22fafabe179b3e08b3107c26
parent3f302f841136ebbcc4da0707fff6faaac4c03e55

update json_test to be compliant with zig source encoding

See #663

1 files changed, 15 insertions(+), 45 deletions(-)

std/json_test.zig+15-45
...@@ -431,15 +431,11 @@ test "y_string_two-byte-utf-8" {...@@ -431,15 +431,11 @@ test "y_string_two-byte-utf-8" {
431}431}
432432
433test "y_string_u+2028_line_sep" {433test "y_string_u+2028_line_sep" {
434 ok(434 ok("[\"\xe2\x80\xa8\"]");
435 \\["
"]
436 );
437}435}
438436
439test "y_string_u+2029_par_sep" {437test "y_string_u+2029_par_sep" {
440 ok(438 ok("[\"\xe2\x80\xa9\"]");
441 \\["
"]
442 );
443}439}
444440
445test "y_string_uescaped_newline" {441test "y_string_uescaped_newline" {
...@@ -455,9 +451,7 @@ test "y_string_uEscape" {...@@ -455,9 +451,7 @@ test "y_string_uEscape" {
455}451}
456452
457test "y_string_unescaped_char_delete" {453test "y_string_unescaped_char_delete" {
458 ok(454 ok("[\"\x7f\"]");
459 \\[""]
460 );
461}455}
462456
463test "y_string_unicode_2" {457test "y_string_unicode_2" {
...@@ -527,9 +521,7 @@ test "y_string_utf8" {...@@ -527,9 +521,7 @@ test "y_string_utf8" {
527}521}
528522
529test "y_string_with_del_character" {523test "y_string_with_del_character" {
530 ok(524 ok("[\"a\x7fa\"]");
531 \\["aa"]
532 );
533}525}
534526
535test "y_structure_lonely_false" {527test "y_structure_lonely_false" {
...@@ -718,9 +710,7 @@ test "n_array_number_and_several_commas" {...@@ -718,9 +710,7 @@ test "n_array_number_and_several_commas" {
718}710}
719711
720test "n_array_spaces_vertical_tab_formfeed" {712test "n_array_spaces_vertical_tab_formfeed" {
721 err(713 err("[\"\x0aa\"\\f]");
722 \\[" a"\f]
723 );
724}714}
725715
726test "n_array_star_inside" {716test "n_array_star_inside" {
...@@ -774,9 +764,7 @@ test "n_incomplete_true" {...@@ -774,9 +764,7 @@ test "n_incomplete_true" {
774}764}
775765
776test "n_multidigit_number_then_00" {766test "n_multidigit_number_then_00" {
777 err(767 err("123\x00");
778 \\123
779 );
780}768}
781769
782test "n_number_0.1.2" {770test "n_number_0.1.2" {
...@@ -1309,9 +1297,7 @@ test "n_string_escaped_ctrl_char_tab" {...@@ -1309,9 +1297,7 @@ test "n_string_escaped_ctrl_char_tab" {
1309}1297}
13101298
1311test "n_string_escaped_emoji" {1299test "n_string_escaped_emoji" {
1312 err(1300 err("[\"\x5c\xc3\xb0\xc2\x9f\xc2\x8c\xc2\x80\"]");
1313 \\["\🌀"]
1314 );
1315}1301}
13161302
1317test "n_string_escape_x" {1303test "n_string_escape_x" {
...@@ -1357,9 +1343,7 @@ test "n_string_invalid_unicode_escape" {...@@ -1357,9 +1343,7 @@ test "n_string_invalid_unicode_escape" {
1357}1343}
13581344
1359test "n_string_invalid_utf8_after_escape" {1345test "n_string_invalid_utf8_after_escape" {
1360 err(1346 err("[\"\\\x75\xc3\xa5\"]");
1361 \\["\å"]
1362 );
1363}1347}
13641348
1365test "n_string_invalid-utf-8-in-escape" {1349test "n_string_invalid-utf-8-in-escape" {
...@@ -1405,9 +1389,7 @@ test "n_string_start_escape_unclosed" {...@@ -1405,9 +1389,7 @@ test "n_string_start_escape_unclosed" {
1405}1389}
14061390
1407test "n_string_unescaped_crtl_char" {1391test "n_string_unescaped_crtl_char" {
1408 err(1392 err("[\"a\x00a\"]");
1409 \\["aa"]
1410 );
1411}1393}
14121394
1413test "n_string_unescaped_newline" {1395test "n_string_unescaped_newline" {
...@@ -1418,9 +1400,7 @@ test "n_string_unescaped_newline" {...@@ -1418,9 +1400,7 @@ test "n_string_unescaped_newline" {
1418}1400}
14191401
1420test "n_string_unescaped_tab" {1402test "n_string_unescaped_tab" {
1421 err(1403 err("[\"\t\"]");
1422 \\[" "]
1423 );
1424}1404}
14251405
1426test "n_string_unicode_CapitalU" {1406test "n_string_unicode_CapitalU" {
...@@ -1532,9 +1512,7 @@ test "n_structure_no_data" {...@@ -1532,9 +1512,7 @@ test "n_structure_no_data" {
1532}1512}
15331513
1534test "n_structure_null-byte-outside-string" {1514test "n_structure_null-byte-outside-string" {
1535 err(1515 err("[\x00]");
1536 \\[]
1537 );
1538}1516}
15391517
1540test "n_structure_number_with_trailing_garbage" {1518test "n_structure_number_with_trailing_garbage" {
...@@ -1718,9 +1696,7 @@ test "n_structure_UTF8_BOM_no_data" {...@@ -1718,9 +1696,7 @@ test "n_structure_UTF8_BOM_no_data" {
1718}1696}
17191697
1720test "n_structure_whitespace_formfeed" {1698test "n_structure_whitespace_formfeed" {
1721 err(1699 err("[\x0c]");
1722 \\[ ]
1723 );
1724}1700}
17251701
1726test "n_structure_whitespace_U+2060_word_joiner" {1702test "n_structure_whitespace_U+2060_word_joiner" {
...@@ -1900,21 +1876,15 @@ test "i_string_truncated-utf-8" {...@@ -1900,21 +1876,15 @@ test "i_string_truncated-utf-8" {
1900}1876}
19011877
1902test "i_string_utf16BE_no_BOM" {1878test "i_string_utf16BE_no_BOM" {
1903 any(1879 any("\x00\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d");
1904 \\["é"]
1905 );
1906}1880}
19071881
1908test "i_string_utf16LE_no_BOM" {1882test "i_string_utf16LE_no_BOM" {
1909 any(1883 any("\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
1910 \\["é"]
1911 );
1912}1884}
19131885
1914test "i_string_UTF-16LE_with_BOM" {1886test "i_string_UTF-16LE_with_BOM" {
1915 any(1887 any("\xc3\xbf\xc3\xbe\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
1916 \\ÿþ["é"]
1917 );
1918}1888}
19191889
1920test "i_string_UTF-8_invalid_sequence" {1890test "i_string_UTF-8_invalid_sequence" {