Skip to content

Commit

Permalink
update json_test to be compliant with zig source encoding
Browse files Browse the repository at this point in the history
See #663
  • Loading branch information
andrewrk committed May 25, 2018
1 parent 3f302f8 commit 56cb7f1
Showing 1 changed file with 15 additions and 45 deletions.
60 changes: 15 additions & 45 deletions std/json_test.zig
Expand Up @@ -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" {
Expand All @@ -455,9 +451,7 @@ test "y_string_uEscape" {
}

test "y_string_unescaped_char_delete" {
ok(
\\[""]
);
ok("[\"\x7f\"]");
}

test "y_string_unicode_2" {
Expand Down Expand Up @@ -527,9 +521,7 @@ test "y_string_utf8" {
}

test "y_string_with_del_character" {
ok(
\\["aa"]
);
ok("[\"a\x7fa\"]");
}

test "y_structure_lonely_false" {
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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" {
Expand All @@ -1418,9 +1400,7 @@ test "n_string_unescaped_newline" {
}

test "n_string_unescaped_tab" {
err(
\\[" "]
);
err("[\"\t\"]");
}

test "n_string_unicode_CapitalU" {
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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" {
Expand Down

0 comments on commit 56cb7f1

Please sign in to comment.