Inconsistency between ToJSON and FromJSON instances of PackageLocation#2412
Inconsistency between ToJSON and FromJSON instances of PackageLocation#2412Blaisorblade merged 1 commit intocommercialhaskell:masterfrom
Conversation
|
Thanks! It looks good and sitting around, so let me try a review:
|
|
My integration tests passed, hence merging. If you also contribute tests, send a PR and I'll fast-track the merge! Thanks! |
|
Thanks! I'll see what I can do about those tests. I did notice the bug by using the |
|
I am not sure how to proceed about the tests. One way could be having a golden value that can be then printed to file and read back, and then check if the final value matches the original. Other way would be doing a QuickCheck based test, requiring an In the other hand, the test directory contains two directories: integration and package-dump. None of these seem to be the place for round-trip tests. |
I'd go the first way—but not to a file, just to Text/ByteString and back, in both directions, and use a few golden values to cover the different cases.
I think you want |
|
Oh, sure, writing the bytestring to a file is pointless. I don't know what I had in mind. |
|
No problem, happens to all of us! 😄 |
This patch fixes the inconsistency between the ToJSON and FromJSON instances of PackageLocation. The problem affects git and hg locations, that are parsed from an object but encoded as strings (in a very different way).