Add mutant catch for incompatible mixed fragment#871
Merged
nothingmuch merged 1 commit intopayjoin:masterfrom Jul 11, 2025
Merged
Add mutant catch for incompatible mixed fragment#871nothingmuch merged 1 commit intopayjoin:masterfrom
nothingmuch merged 1 commit intopayjoin:masterfrom
Conversation
Collaborator
Pull Request Test Coverage Report for Build 16227902588Details
💛 - Coveralls |
320119f to
130685b
Compare
nothingmuch
requested changes
Jul 11, 2025
Collaborator
nothingmuch
left a comment
There was a problem hiding this comment.
Derp, i forgot to check coverage on the PR that introduced that, pretty embarassing.
The test assertion seems correct but is kind of confusing, so either it needs to be simplified or I missed something and a comment is needed
payjoin/src/core/uri/url_ext.rs
Outdated
Comment on lines
522
to
526
| let delimiter_check = check_fragment_delimiter(fragment); | ||
|
|
||
| match delimiter_check { | ||
| Err(ParseFragmentError::AmbiguousDelimiter) => { | ||
| assert!(matches!( | ||
| delimiter_check.err(), | ||
| Some(ParseFragmentError::AmbiguousDelimiter) | ||
| )); | ||
| } | ||
| _ => panic!("Expected AmbitiousDelimiter error, got Ok or unexpected error"), | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
isn't this sufficient? seems like the inner match on .err() just re-asserts the same thing after convering the outer Err to a Some?
Suggested change
| let delimiter_check = check_fragment_delimiter(fragment); | |
| match delimiter_check { | |
| Err(ParseFragmentError::AmbiguousDelimiter) => { | |
| assert!(matches!( | |
| delimiter_check.err(), | |
| Some(ParseFragmentError::AmbiguousDelimiter) | |
| )); | |
| } | |
| _ => panic!("Expected AmbitiousDelimiter error, got Ok or unexpected error"), | |
| } | |
| } | |
| assert!(matches!( | |
| check_fragment_delimiter(fragment), | |
| Err(ParseFragmentError::AmbiguousDelimiter), | |
| )); |
Collaborator
Author
There was a problem hiding this comment.
No, it defintely can be the more simplified approach, good call
130685b to
4ca35a5
Compare
We did not have a test demonstrating that fragement delimiters could not be mixed.
4ca35a5 to
7635056
Compare
nothingmuch
approved these changes
Jul 11, 2025
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.
We did not have a test demonstrating that fragment delimiters could not be mixed.
Plus a test name typo