2018-05-02 07:04:40 +01:00
|
|
|
|
// RFC 8529 conformance tests.
|
|
|
|
|
//
|
|
|
|
|
// Tests are taken from https://github.com/nst/JSONTestSuite
|
|
|
|
|
// Read also http://seriot.ch/parsing_json.php for a good overview.
|
|
|
|
|
|
2019-04-29 19:02:19 +01:00
|
|
|
|
const std = @import("../std.zig");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
|
|
|
|
|
fn ok(comptime s: []const u8) void {
|
2019-02-08 23:18:47 +00:00
|
|
|
|
std.testing.expect(std.json.validate(s));
|
2019-11-11 21:06:00 +00:00
|
|
|
|
|
2020-02-01 03:27:59 +00:00
|
|
|
|
var p = std.json.Parser.init(std.testing.allocator, false);
|
|
|
|
|
defer p.deinit();
|
2019-11-11 21:06:00 +00:00
|
|
|
|
|
2020-02-01 03:27:59 +00:00
|
|
|
|
var tree = p.parse(s) catch unreachable;
|
|
|
|
|
defer tree.deinit();
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn err(comptime s: []const u8) void {
|
2019-02-08 23:18:47 +00:00
|
|
|
|
std.testing.expect(!std.json.validate(s));
|
2019-11-11 21:06:00 +00:00
|
|
|
|
|
2020-02-01 03:27:59 +00:00
|
|
|
|
var p = std.json.Parser.init(std.testing.allocator, false);
|
|
|
|
|
defer p.deinit();
|
2019-11-11 21:06:00 +00:00
|
|
|
|
|
2020-01-06 20:34:50 +00:00
|
|
|
|
if (p.parse(s)) |_| {
|
2019-11-11 21:06:00 +00:00
|
|
|
|
unreachable;
|
|
|
|
|
} else |_| {}
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-06 07:16:38 +00:00
|
|
|
|
fn utf8Error(comptime s: []const u8) void {
|
|
|
|
|
std.testing.expect(!std.json.validate(s));
|
|
|
|
|
|
2020-02-01 03:27:59 +00:00
|
|
|
|
var p = std.json.Parser.init(std.testing.allocator, false);
|
|
|
|
|
defer p.deinit();
|
2020-01-06 07:16:38 +00:00
|
|
|
|
|
|
|
|
|
if (p.parse(s)) |_| {
|
|
|
|
|
unreachable;
|
|
|
|
|
} else |e| {
|
|
|
|
|
std.testing.expect(e == error.InvalidUtf8Byte);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
fn any(comptime s: []const u8) void {
|
2019-11-11 21:06:00 +00:00
|
|
|
|
_ = std.json.validate(s);
|
|
|
|
|
|
2020-02-01 03:27:59 +00:00
|
|
|
|
var p = std.json.Parser.init(std.testing.allocator, false);
|
|
|
|
|
defer p.deinit();
|
2020-01-06 20:34:50 +00:00
|
|
|
|
|
2020-02-01 03:27:59 +00:00
|
|
|
|
var tree = p.parse(s) catch return;
|
|
|
|
|
defer tree.deinit();
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
fn anyStreamingErrNonStreaming(comptime s: []const u8) void {
|
|
|
|
|
_ = std.json.validate(s);
|
|
|
|
|
|
2020-02-01 03:27:59 +00:00
|
|
|
|
var p = std.json.Parser.init(std.testing.allocator, false);
|
|
|
|
|
defer p.deinit();
|
2019-11-11 22:41:53 +00:00
|
|
|
|
|
2020-01-06 20:34:50 +00:00
|
|
|
|
if (p.parse(s)) |_| {
|
2019-11-11 22:41:53 +00:00
|
|
|
|
unreachable;
|
|
|
|
|
} else |_| {}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-08 06:43:13 +01:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Additional tests not part of test JSONTestSuite.
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_trailing_comma_after_empty" {
|
2018-06-08 06:43:13 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"1":[],"2":{},"3":"4"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_arraysWithSpaces" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[[] ]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_empty" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_empty-string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_ending_with_newline" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["a"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_false" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[false]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_heterogeneous" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[null, 1, "1", {}]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_null" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[null]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_with_1_and_newline" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[1
|
|
|
|
|
\\]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_with_leading_space" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\ [1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_with_several_null" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[1,null,null,null,2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_array_with_trailing_space" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
ok("[2] ");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_0e+1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[0e+1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_0e1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[0e1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_after_space" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[ 4]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_double_close_to_zero" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_int_with_exp" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[20e1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[123e65]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_minus_zero" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[-0]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_negative_int" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[-123]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_negative_one" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[-1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_negative_zero" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[-0]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_real_capital_e" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[1E22]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_real_capital_e_neg_exp" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[1E-2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_real_capital_e_pos_exp" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[1E+2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_real_exponent" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[123e45]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_real_fraction_exponent" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[123.456e78]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_real_neg_exp" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[1e-2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_real_pos_exponent" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[1e+2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_simple_int" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[123]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_number_simple_real" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[123.456789]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_basic" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"asd":"sdf"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_duplicated_key_and_value" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"a":"b","a":"b"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_duplicated_key" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"a":"b","a":"c"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_empty" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_empty_key" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"":0}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_escaped_null_in_key" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"foo\u0000bar": 42}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_extreme_numbers" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{ "min": -1.0e+28, "max": 1.0e+28 }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"asd":"sdf", "dfg":"fgh"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_long_strings" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_simple" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"a":[]}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_string_unicode" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_object_with_newlines" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\{
|
|
|
|
|
\\"a": "b"
|
|
|
|
|
\\}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_1_2_3_bytes_UTF-8_sequences" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u0060\u012a\u12AB"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_accepted_surrogate_pair" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uD801\udc37"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_accepted_surrogate_pairs" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\ud83d\ude39\ud83d\udc8d"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_allowed_escapes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\"\\\/\b\f\n\r\t"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_backslash_and_u_escaped_zero" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\\u0000"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_backslash_doublequotes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_comments" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["a/*b*/c/*d//e"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_double_escape_a" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\\a"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_double_escape_n" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\\n"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_escaped_control_character" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u0012"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_escaped_noncharacter" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uFFFF"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_in_array" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["asd"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_in_array_with_leading_space" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[ "asd"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_last_surrogates_1_and_2" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uDBFF\uDFFF"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_nbsp_uescaped" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["new\u00A0line"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_nonCharacterInUTF-8_U+10FFFF" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_nonCharacterInUTF-8_U+FFFF" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_null_escape" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u0000"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_one-byte-utf-8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u002c"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_pi" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["π"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_reservedCharacterInUTF-8_U+1BFFF" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_simple_ascii" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["asd "]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_space" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\" "
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uD834\uDd1e"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_three-byte-utf-8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u0821"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_two-byte-utf-8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u0123"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_u+2028_line_sep" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
ok("[\"\xe2\x80\xa8\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_u+2029_par_sep" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
ok("[\"\xe2\x80\xa9\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_uescaped_newline" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["new\u000Aline"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_uEscape" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u0061\u30af\u30EA\u30b9"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unescaped_char_delete" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
ok("[\"\x7f\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_2" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["⍂㈴⍂"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicodeEscapedBackslash" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u005C"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_escaped_double_quote" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u0022"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uA66D"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_U+10FFFE_nonchar" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uDBFF\uDFFE"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_U+1FFFE_nonchar" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uD83F\uDFFE"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_U+200B_ZERO_WIDTH_SPACE" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u200B"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_U+2064_invisible_plus" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\u2064"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_U+FDD0_nonchar" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uFDD0"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_unicode_U+FFFE_nonchar" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["\uFFFE"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_utf8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["€𝄞"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_string_with_del_character" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
ok("[\"a\x7fa\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_lonely_false" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\false
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_lonely_int" {
|
2019-11-11 22:25:54 +00:00
|
|
|
|
ok(
|
|
|
|
|
\\42
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_lonely_negative_real" {
|
2019-11-11 22:25:54 +00:00
|
|
|
|
ok(
|
|
|
|
|
\\-0.1
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_lonely_null" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\null
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_lonely_string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\"asd"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_lonely_true" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\true
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_string_empty" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\""
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_trailing_newline" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\["a"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_true_in_array" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
ok(
|
|
|
|
|
\\[true]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "y_structure_whitespace_array" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
ok(" [] ");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_1_true_without_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1 true]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_a_invalid_utf8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[aå]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_colon_instead_of_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["": 1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_comma_after_close" {
|
2019-11-11 21:06:00 +00:00
|
|
|
|
err(
|
|
|
|
|
\\[""],
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_comma_and_number" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[,1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_double_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1,,2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_double_extra_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["x",,]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_extra_close" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["x"]]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_extra_comma" {
|
2019-11-11 21:06:00 +00:00
|
|
|
|
err(
|
|
|
|
|
\\["",]
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_incomplete_invalid_value" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[x
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_incomplete" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["x"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_inner_array_no_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[3[4]]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_invalid_utf8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[ÿ]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_items_separated_by_semicolon" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1:2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_just_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[,]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_just_minus" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_missing_value" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[ , ""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_newlines_unclosed" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["a",
|
|
|
|
|
\\4
|
|
|
|
|
\\,1,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_number_and_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1,]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_number_and_several_commas" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1,,]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_spaces_vertical_tab_formfeed" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("[\"\x0aa\"\\f]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_star_inside" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[*]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_unclosed" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[""
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_unclosed_trailing_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_unclosed_with_new_lines" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1,
|
|
|
|
|
\\1
|
|
|
|
|
\\,1
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_array_unclosed_with_object_inside" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[{}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_incomplete_false" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[fals]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_incomplete_null" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[nul]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_incomplete_true" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[tru]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_multidigit_number_then_00" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("123\x00");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0.1.2" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0.1.2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_-01" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-01]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0.3e" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0.3e]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0.3e+" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0.3e+]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0_capital_E" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0E]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0_capital_E+" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0E+]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0.e1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0.e1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0e" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0e]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_0e+" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0e+]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_1_000" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1 000.0]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_1.0e-" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1.0e-]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_1.0e" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1.0e]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_1.0e+" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1.0e+]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_-1.0." {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-1.0.]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_1eE2" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1eE2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_.-1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[.-1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_+1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[+1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_.2e-3" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[.2e-3]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_2.e-3" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[2.e-3]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_2.e+3" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[2.e+3]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_2.e3" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[2.e3]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_-2." {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-2.]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_9.e+" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[9.e+]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_expression" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1+2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_hex_1_digit" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0x1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_hex_2_digits" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0x42]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_infinity" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[Infinity]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_+Inf" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[+Inf]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_Inf" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[Inf]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_invalid+-" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0e+-1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_invalid-negative-real" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-123.123foo]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_invalid-utf-8-in-bigger-int" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[123å]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_invalid-utf-8-in-exponent" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1e1å]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_invalid-utf-8-in-int" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[0å]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_++" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[++1234]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_minus_infinity" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-Infinity]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_minus_sign_with_trailing_garbage" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-foo]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_minus_space_1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[- 1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_-NaN" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-NaN]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_NaN" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[NaN]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_neg_int_starting_with_zero" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-012]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_neg_real_without_int_part" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-.123]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_neg_with_garbage_at_end" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[-1x]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_real_garbage_after_e" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1ea]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_real_with_invalid_utf8_after_e" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1eå]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_real_without_fractional_part" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1.]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_starting_with_dot" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[.123]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_U+FF11_fullwidth_digit_one" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[ï¼]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_with_alpha_char" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1.8011670033376514H-308]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_with_alpha" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1.2a-3]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_number_with_leading_zero" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[012]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_bad_value" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["x", truth]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_bracket_key" {
|
2019-11-11 22:25:54 +00:00
|
|
|
|
err(
|
|
|
|
|
\\{[: "x"}
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_comma_instead_of_colon" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"x", null}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_double_colon" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"x"::"b"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_emoji" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{ð¨ð}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_garbage_at_end" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"a" 123}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_key_with_single_quotes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{key: 'value'}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_lone_continuation_byte_in_key_and_trailing_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"¹":"0",}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_missing_colon" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a" b}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_missing_key" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{:"b"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_missing_semicolon" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a" "b"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_missing_value" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_no-colon" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_non_string_key_but_huge_number_instead" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{9999E9999:1}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_non_string_key" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{1:1}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_repeated_null_null" {
|
2019-11-11 22:25:54 +00:00
|
|
|
|
err(
|
|
|
|
|
\\{null:null,null:null}
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_several_trailing_commas" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"id":0,,,,,}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_single_quote" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{'a':0}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_trailing_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"id":0,}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_trailing_comment" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"b"}/**/
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_trailing_comment_open" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"b"}/**//
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_trailing_comment_slash_open_incomplete" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"b"}/
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_trailing_comment_slash_open" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"b"}//
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_two_commas_in_a_row" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"b",,"c":"d"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_unquoted_key" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{a: "b"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_unterminated-value" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"a
|
|
|
|
|
);
|
2018-05-29 23:10:36 +01:00
|
|
|
|
}
|
2018-05-02 07:04:40 +01:00
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_with_single_string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{ "foo" : "bar", "a" }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_object_with_trailing_garbage" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"b"}#
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_single_space" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
err(" ");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_1_surrogate_then_escape" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uD800\"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_1_surrogate_then_escape_u1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uD800\u1"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_1_surrogate_then_escape_u1x" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uD800\u1x"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_1_surrogate_then_escape_u" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uD800\u"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_accentuated_char_no_quotes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[é]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_backslash_00" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
err("[\"\x00\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_escaped_backslash_bad" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\\\"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_escaped_ctrl_char_tab" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
err("\x5b\x22\x5c\x09\x22\x5d");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_escaped_emoji" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("[\"\x5c\xc3\xb0\xc2\x9f\xc2\x8c\xc2\x80\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_escape_x" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\x00"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_incomplete_escaped_character" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\u00A"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_incomplete_escape" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_incomplete_surrogate_escape_invalid" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uD800\uD800\x"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_incomplete_surrogate" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uD834\uDd"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_invalid_backslash_esc" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\a"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_invalid_unicode_escape" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uqqqq"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_invalid_utf8_after_escape" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("[\"\\\x75\xc3\xa5\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_invalid-utf-8-in-escape" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\uå"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_leading_uescaped_thinspace" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[\u0020"asd"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_no_quotes_with_bad_escape" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[\n]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_single_doublequote" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_single_quote" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\['single quote']
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_single_string_no_double_quotes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\abc
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_start_escape_unclosed" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_unescaped_crtl_char" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("[\"a\x00a\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_unescaped_newline" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["new
|
|
|
|
|
\\line"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_unescaped_tab" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("[\"\t\"]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_unicode_CapitalU" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\"\UA66D"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_string_with_trailing_garbage" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\""x
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_100000_opening_arrays" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
err("[" ** 100000);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_angle_bracket_." {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\<.>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_angle_bracket_null" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[<null>]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_array_trailing_garbage" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1]x
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_array_with_extra_array_close" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1]]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_array_with_unclosed_string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["asd]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_ascii-unicode-identifier" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\aå
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_capitalized_True" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[True]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_close_unopened_array" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_comma_instead_of_closing_brace" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"x": true,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_double_array" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[][]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_end_array" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_incomplete_UTF8_BOM" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\ï»{}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_lone-invalid-utf-8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\å
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_lone-open-bracket" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_no_data" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_null-byte-outside-string" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("[\x00]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_number_with_trailing_garbage" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\2@
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_object_followed_by_closing_object" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{}}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_object_unclosed_no_value" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"":
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_object_with_comment" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":/*comment*/"b"}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_object_with_trailing_garbage" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a": true} "x"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_array_apostrophe" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\['
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_array_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_array_object" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
err("[{\"\":" ** 50000);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_array_open_object" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[{
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_array_open_string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["a
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_array_string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["a"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_object_close_array" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_object_comma" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_object" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_object_open_array" {
|
2019-11-11 22:25:54 +00:00
|
|
|
|
err(
|
|
|
|
|
\\{[
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_object_open_string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_object_string_with_apostrophes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{'a'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_open_open" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\["\{["\{["\{["\{
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_single_eacute" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\é
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_single_star" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\*
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_trailing_#" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"a":"b"}#{}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_U+2060_word_joined" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[â ]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_uescaped_LF_before_string" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[\u000A""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_unclosed_array" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[1
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_unclosed_array_partial_null" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[ false, nul
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_unclosed_array_unfinished_false" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[ true, fals
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_unclosed_array_unfinished_true" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[ false, tru
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_unclosed_object" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\{"asd":"asd"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_unicode-identifier" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\Ã¥
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_UTF8_BOM_no_data" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_whitespace_formfeed" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
err("[\x0c]");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "n_structure_whitespace_U+2060_word_joiner" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
err(
|
|
|
|
|
\\[â ]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_double_huge_neg_exp" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[123.456e-789]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_huge_exp" {
|
2020-03-29 05:54:23 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]
|
|
|
|
|
);
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_neg_int_huge_exp" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[-1e+9999]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_pos_double_huge_exp" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[1.5e+9999]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_real_neg_overflow" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[-123123e100000]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_real_pos_overflow" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[123123e100000]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_real_underflow" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[123e-10000000]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_too_big_neg_int" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[-123123123123123123123123123123]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_too_big_pos_int" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[100000000000000000000]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_number_very_big_negative_int" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[-237462374673276894279832749832423479823246327846]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_object_key_lone_2nd_surrogate" {
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\{"\uDFAA":0}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_1st_surrogate_but_2nd_missing" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\uDADA"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_1st_valid_surrogate_2nd_invalid" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\uD888\u1234"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_incomplete_surrogate_and_escape_valid" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\uD800\n"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_incomplete_surrogate_pair" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\uDd1ea"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_incomplete_surrogates_escape_valid" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\uD800\uD800\n"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_invalid_lonely_surrogate" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\ud800"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_invalid_surrogate" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\ud800abc"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_invalid_utf-8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["ÿ"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_inverted_surrogates_U+1D11E" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\uDd1e\uD834"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_iso_latin_1" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["é"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_lone_second_surrogate" {
|
2020-04-21 17:42:21 +01:00
|
|
|
|
// https://github.com/ziglang/zig/issues/5127
|
|
|
|
|
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
|
|
|
|
2019-11-11 22:41:53 +00:00
|
|
|
|
anyStreamingErrNonStreaming(
|
2018-05-02 07:04:40 +01:00
|
|
|
|
\\["\uDFAA"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_lone_utf8_continuation_byte" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\[""]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_not_in_unicode_range" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["ô¿¿¿"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_overlong_sequence_2_bytes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["À¯"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_overlong_sequence_6_bytes" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["ü¿¿¿¿"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_overlong_sequence_6_bytes_null" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["ü"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_truncated-utf-8" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["àÿ"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_utf16BE_no_BOM" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
any("\x00\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_utf16LE_no_BOM" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
any("\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_UTF-16LE_with_BOM" {
|
2018-05-25 07:08:43 +01:00
|
|
|
|
any("\xc3\xbf\xc3\xbe\x5b\x00\x22\x00\xc3\xa9\x00\x22\x00\x5d\x00");
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_UTF-8_invalid_sequence" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["æ¥Ñú"]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_string_UTF8_surrogate_U+D800" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\["í "]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_structure_500_nested_arrays" {
|
2018-05-29 23:10:36 +01:00
|
|
|
|
any(("[" ** 500) ++ ("]" ** 500));
|
2018-05-02 07:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-29 19:04:31 +01:00
|
|
|
|
test "i_structure_UTF-8_BOM_empty_object" {
|
2018-05-02 07:04:40 +01:00
|
|
|
|
any(
|
|
|
|
|
\\{}
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-01-06 07:16:38 +00:00
|
|
|
|
|
|
|
|
|
test "truncated UTF-8 sequence" {
|
|
|
|
|
utf8Error("\"\xc2\"");
|
|
|
|
|
utf8Error("\"\xdf\"");
|
|
|
|
|
utf8Error("\"\xed\xa0\"");
|
|
|
|
|
utf8Error("\"\xf0\x80\"");
|
|
|
|
|
utf8Error("\"\xf0\x80\x80\"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test "invalid continuation byte" {
|
|
|
|
|
utf8Error("\"\xc2\x00\"");
|
|
|
|
|
utf8Error("\"\xc2\x7f\"");
|
|
|
|
|
utf8Error("\"\xc2\xc0\"");
|
|
|
|
|
utf8Error("\"\xc3\xc1\"");
|
|
|
|
|
utf8Error("\"\xc4\xf5\"");
|
|
|
|
|
utf8Error("\"\xc5\xff\"");
|
|
|
|
|
utf8Error("\"\xe4\x80\x00\"");
|
|
|
|
|
utf8Error("\"\xe5\x80\x10\"");
|
|
|
|
|
utf8Error("\"\xe6\x80\xc0\"");
|
|
|
|
|
utf8Error("\"\xe7\x80\xf5\"");
|
|
|
|
|
utf8Error("\"\xe8\x00\x80\"");
|
|
|
|
|
utf8Error("\"\xf2\x00\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xf0\x80\x00\x80\"");
|
|
|
|
|
utf8Error("\"\xf1\x80\xc0\x80\"");
|
|
|
|
|
utf8Error("\"\xf2\x80\x80\x00\"");
|
|
|
|
|
utf8Error("\"\xf3\x80\x80\xc0\"");
|
|
|
|
|
utf8Error("\"\xf4\x80\x80\xf5\"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test "disallowed overlong form" {
|
|
|
|
|
utf8Error("\"\xc0\x80\"");
|
|
|
|
|
utf8Error("\"\xc0\x90\"");
|
|
|
|
|
utf8Error("\"\xc1\x80\"");
|
|
|
|
|
utf8Error("\"\xc1\x90\"");
|
|
|
|
|
utf8Error("\"\xe0\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xf0\x80\x80\x80\"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test "out of UTF-16 range" {
|
|
|
|
|
utf8Error("\"\xf4\x90\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xf5\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xf6\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xf7\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xf8\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xf9\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xfa\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xfb\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xfc\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xfd\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xfe\x80\x80\x80\"");
|
|
|
|
|
utf8Error("\"\xff\x80\x80\x80\"");
|
|
|
|
|
}
|