Commit 56cb7f1740

Andrew Kelley <superjoe30@gmail.com>
2018-05-25 08:08:43
update json_test to be compliant with zig source encoding
See #663
1 parent 3f302f8
Changed files (1)
std/json_test.zig
@@ -431,15 +431,11 @@ test "y_string_two-byte-utf-8" {
 }
 
 test "y_string_u+2028_line_sep" {
-    ok(
-        \\["
"]
-    );
+    ok("[\"\xe2\x80\xa8\"]");
 }
 
 test "y_string_u+2029_par_sep" {
-    ok(
-        \\["
"]
-    );
+    ok("[\"\xe2\x80\xa9\"]");
 }
 
 test "y_string_uescaped_newline" {
@@ -455,9 +451,7 @@ test "y_string_uEscape" {
 }
 
 test "y_string_unescaped_char_delete" {
-    ok(
-        \\[""]
-    );
+    ok("[\"\x7f\"]");
 }
 
 test "y_string_unicode_2" {
@@ -527,9 +521,7 @@ test "y_string_utf8" {
 }
 
 test "y_string_with_del_character" {
-    ok(
-        \\["aa"]
-    );
+    ok("[\"a\x7fa\"]");
 }
 
 test "y_structure_lonely_false" {
@@ -718,9 +710,7 @@ test "n_array_number_and_several_commas" {
 }
 
 test "n_array_spaces_vertical_tab_formfeed" {
-    err(
-        \\["a"\f]
-    );
+    err("[\"\x0aa\"\\f]");
 }
 
 test "n_array_star_inside" {
@@ -774,9 +764,7 @@ test "n_incomplete_true" {
 }
 
 test "n_multidigit_number_then_00" {
-    err(
-        \\123
-    );
+    err("123\x00");
 }
 
 test "n_number_0.1.2" {
@@ -1309,9 +1297,7 @@ test "n_string_escaped_ctrl_char_tab" {
 }
 
 test "n_string_escaped_emoji" {
-    err(
-        \\["\🌀"]
-    );
+    err("[\"\x5c\xc3\xb0\xc2\x9f\xc2\x8c\xc2\x80\"]");
 }
 
 test "n_string_escape_x" {
@@ -1357,9 +1343,7 @@ test "n_string_invalid_unicode_escape" {
 }
 
 test "n_string_invalid_utf8_after_escape" {
-    err(
-        \\["\å"]
-    );
+    err("[\"\\\x75\xc3\xa5\"]");
 }
 
 test "n_string_invalid-utf-8-in-escape" {
@@ -1405,9 +1389,7 @@ test "n_string_start_escape_unclosed" {
 }
 
 test "n_string_unescaped_crtl_char" {
-    err(
-        \\["aa"]
-    );
+    err("[\"a\x00a\"]");
 }
 
 test "n_string_unescaped_newline" {
@@ -1418,9 +1400,7 @@ test "n_string_unescaped_newline" {
 }
 
 test "n_string_unescaped_tab" {
-    err(
-        \\["	"]
-    );
+    err("[\"\t\"]");
 }
 
 test "n_string_unicode_CapitalU" {
@@ -1532,9 +1512,7 @@ test "n_structure_no_data" {
 }
 
 test "n_structure_null-byte-outside-string" {
-    err(
-        \\[]
-    );
+    err("[\x00]");
 }
 
 test "n_structure_number_with_trailing_garbage" {
@@ -1718,9 +1696,7 @@ test "n_structure_UTF8_BOM_no_data" {
 }
 
 test "n_structure_whitespace_formfeed" {
-    err(
-        \\[]
-    );
+    err("[\x0c]");
 }
 
 test "n_structure_whitespace_U+2060_word_joiner" {
@@ -1900,21 +1876,15 @@ test "i_string_truncated-utf-8" {
 }
 
 test "i_string_utf16BE_no_BOM" {
-    any(
-        \\["é"]
-    );
+    any("\x00\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d");
 }
 
 test "i_string_utf16LE_no_BOM" {
-    any(
-        \\["é"]
-    );
+    any("\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
 }
 
 test "i_string_UTF-16LE_with_BOM" {
-    any(
-        \\ÿþ["é"]
-    );
+    any("\xc3\xbf\xc3\xbe\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
 }
 
 test "i_string_UTF-8_invalid_sequence" {