Closed nathanfallet closed 2 years ago
@NathanFallet the test is brittle because it compares the JSON as a string. On Linux the JSON serialization is different (order of fields). You could make the JSON serialization more deterministic with OutputFormatting.sortedKeys
(but that's only iOS 11+, macOS 10.13+) or improve the test so that it does not do a by string comparison.
@jberkel Right, I'm gonna inspect that. I need to understand why it changed since the last commit (because test was passing for the last commit on master)
@NathanFallet the test is brittle because it compares the JSON as a string. On Linux the JSON serialization is different (order of fields). You could make the JSON serialization more deterministic with
OutputFormatting.sortedKeys
(but that's only iOS 11+, macOS 10.13+) or improve the test so that it does not do a by string comparison.
After inspection, it means that JSONEncoder().encode(value)
gives different data each time, even with the same object passed as value
?!
After inspection, it means that
JSONEncoder().encode(value)
gives different data each time, even with the same object passed asvalue
?!
Possibly, there are no guarantees by the method. I think we should do both: make the JSON output consistent (with sortedKeys
) if possible, and avoid doing a string comparison in the test.
@jberkel Test fails on Linux because of something related to encodable, but I don't think that it is related to my changes. Do you have any idea?