Changes test assertions to compare wrapped values#365
Changes test assertions to compare wrapped values#365petertseng merged 1 commit intoexercism:masterfrom nfiles:issue-338
Conversation
| #[test] | ||
| #[ignore] | ||
| fn second_bonus_ball_after_a_final_strike_can_not_score_an_invalid_number_of_pins_even_if_first_is_strike() { | ||
| fn second_bonus_ball_after_a_final_strike_can_not_score_an_invalid_number_of_pins_even_if_first_is_strike(){ |
There was a problem hiding this comment.
accidental removal of space?
| } | ||
| // may fail with a message that clearly shows all extra pairs in the map | ||
| assert_eq!(m.iter().collect::<Vec<(&char,&usize)>>(), vec!()); | ||
| assert_eq!(m.iter().collect::<Vec<(&char, &usize)>>(), vec!()); |
There was a problem hiding this comment.
the addition of a space is good, but isn't related to removing unwrap, so it should go in a separate commit
|
I have committed a revised changeset that reverts the spacing issues. :) |
petertseng
left a comment
There was a problem hiding this comment.
Fantastic, thanks for taking the time to do this.
Please forgive a few silly questions:
After this is merged, are there any remaining instances of unwrap that should be changed? I do know there are other instances of unwrap, but not necessarily whether they should be changed.
If there are not, it would be appropriate to close #338 and you should use one of https://help.github.com/articles/closing-issues-using-keywords/ in your commit message and/or pull request description.
If there are, I'll take your word for it. It would be great, but not required, if you would briefly describe what's left to do (I assume you looked through a few of them while making this PR).
About all those as_slice that turned into vec!, I think Vec was in fact the only type the optional type could have taken on, correct? So we are not unnecessarily restricting anyone's solution to using Vecs when they could have used some other type instead, right? A quick search on my part tells me this is true.
(Well, unless they implement some custom type that defines as_slice, but I don't think anyone actually wants to do that)
|
No problem!
I think the remaining
That's a good point about the This pull request resolves #338 |
|
Thanks again. When I am able, I will also check to see whether I agree with your assessment, and assuming I do then it will be time to merge it.
That needs to be in the PR description (the one that currently says "Related to Issue #338") OR any commit message in the PR. |
|
Sorry, I understand now. I have updated the PR description. |
|
OK. I agree with all your assessments. And they are definitely not unwraps that are compared, so objective achieved. I may consider a new issue for providing better error messages when the unwraps fail, if there is demand for it (or someone else may open it, that will be sufficient demand). As for this PR, it is time to merge, and close the referenced issue. I will be making a change to the commit messages. They should be written in imperative form to match with the messages that |
|
Thanks (yet) again, great stuff. |
Resolves #338
Test assertions should compare
OptionorResultvalues directly instead of unwrapping them.