Fixed AnyDecodableTests.testNull on iOS 12#1589
Merged
Merged
Conversation
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6737/workflows/b945f5f6-6f31-4716-b1ac-6e16e3848c7e/jobs/26321 For some reason, on iOS 12.x only, this: ```swift JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: ``` dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) ``` We don't rely on decoding fragments, so I just updated the test to check `.null` within a dictionary instead.
60df869 to
6823c7e
Compare
aboedo
approved these changes
May 24, 2022
NachoSoto
added a commit
that referenced
this pull request
May 24, 2022
Follow up to #1589. Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6805/workflows/550827f9-ff8e-469d-b7a7-889417582eff/jobs/26743 Turns out the tests introduced in #1558 weren't compatible with iOS 12. As explained in #1589. For some reason, on iOS 12.x only, this: ``` JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: > dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) Since iOS 12.x doesn't allow decoding top-level objects, I've simply disabled these tests. Decoding this types is already tested as part of other types. These new types only added more explicit testing.
NachoSoto
added a commit
that referenced
this pull request
May 24, 2022
Follow up to #1589. Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6805/workflows/550827f9-ff8e-469d-b7a7-889417582eff/jobs/26743 Turns out the tests introduced in #1558 weren't compatible with iOS 12. As explained in #1589. For some reason, on iOS 12.x only, this: ``` JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: > dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) Since iOS 12.x doesn't allow decoding top-level objects, I've simply disabled these tests. Decoding this types is already tested as part of other types. These new types only added more explicit testing.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6737/workflows/b945f5f6-6f31-4716-b1ac-6e16e3848c7e/jobs/26321
For some reason, on iOS 12.x only, this:
Fails:
We don't rely on decoding fragments, so I just updated the test to check
.nullwithin a dictionary instead.