-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added decoder for URL. Also, added tests for dates and URLs. #127
Conversation
} catch DecodingError.rawRepresentableInitializationError(_, _) { | ||
//then | ||
XCTAssertTrue(true) | ||
} catch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not catch let error
and then change the output to indicate the incorrect exception being thrown?
//given | ||
let anyObject = "1970-01-01T00:00:00Z" | ||
//when | ||
let date = try! Date.decoder(anyObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests should use .decode()
method instead of .decoder()
@@ -98,3 +98,15 @@ extension NSArray: DynamicDecodable { | |||
} | |||
|
|||
} | |||
|
|||
|
|||
extension URL: DynamicDecodable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should inherit from Decodable
as well so that the decode()
is available.
let anyObject = "" | ||
//when | ||
do { | ||
_ = try URL.decoder(anyObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are testing the Date
decoding, we should probably use the Date
object. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoopsie 😅 . I should've been clearer mentally while writing this.
I'll make the changes you've suggested soon.
Meanwhile, let me just say: decode is 💯
@voidref Any more suggestions? |
@codeOfRobin Just that the calls to |
@voidref Done! 👍 |
LGTM, I am not a maintainer, just a contributor, so you'll need to wait for @Anviking to have time to review and merge. Thanks! |
LGTM too. Thanks, @codeOfRobin, and thanks, @voidref for reviewing! |
@voidref I just invited you as a repo collaborator also in case you want to! |
No description provided.