Open 314eter opened 7 years ago
Cool.
This is a great test suite, and yojson doesn't have any. Would you like to leave a script that would fetch and run this test suite?
I'll add the successful ones to the current test suite and the rest of the test cases to a separate one.
Then we can start fixing the ones worth fixing and migrate them from one test suite to the other to ensure we don't break compliance in the future.
The crashes were all fixed by #35, so only the SHOULD_HAVE_FAILED
are left.
Yeah I just ran the test suite I added right now with Yojson.Safe
and the remaining failures are:
n_structure_object_with_comment.json
n_structure_angle_bracket_null.json
n_string_unescaped_tab.json
n_string_unescaped_newline.json
n_string_unescaped_crtl_char.json
n_object_unquoted_key.json
n_object_trailing_comment_slash_open.json
n_object_trailing_comment.json
n_object_repeated_null_null.json
n_number_minus_infinity.json
n_number_infinity.json
n_number_NaN.json
I'll polish the test suite a bit to get a better output on the failures and get it merged so we have something to work on.
It seems like it's a slightly different set of failures but the test suite now covers the more up-to-date RFC 8259 which explains some differences.
I tested Yojson on the test cases of https://github.com/nst/JSONTestSuite:
The problems are:
Yojson.Safe.from_string "x"
) raise a "Failure "lexing: empty token" exception instead of aJson_error
.NaN
andInfinity
, duplicate keys, comments, unquoted keys and unquoted control characters, tabs or newlines are not permitted according to RFC 7159. I don't think it's a problem to support some extensions to the specification, as long asto_string
always returns valid json. In that case, onlyNaN
andInfinity
and duplicate keys are problematic.