Skip to content

Commit c8b4f36

Browse files
authored
Add mutant catch for incompatible mixed fragment (payjoin#871)
We did not have a test demonstrating that fragment delimiters could not be mixed. Plus a test name typo
2 parents 5a436f3 + 7635056 commit c8b4f36

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

payjoin/src/core/uri/url_ext.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ mod tests {
465465
}
466466

467467
#[test]
468-
fn test_fragment_delimeter_backwards_compatibility() {
468+
fn test_fragment_delimiter_backwards_compatibility() {
469469
// ensure + is still accepted as a delimiter
470470
let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=0.01\
471471
&pjos=0&pj=HTTPS://EXAMPLE.COM/\
@@ -513,4 +513,15 @@ mod tests {
513513
Some("EX1C4UC6ES-OH1QYPM5JXYNS754Y4R45QWE336QFX6ZR8DQGVQCULVZTV20TFVEYDMFQC")
514514
);
515515
}
516+
517+
#[test]
518+
fn test_fragment_mixed_delimiter() {
519+
// mixing current and deprecated delimiters should fail
520+
let fragment = "23RK1QG2RH36X9ZWRK\
521+
7UWCCQE0WD8T89XKK2W55KTK9UHSZLEG8Q2TGEGG-OH1QYP87E2AVMDKXDTU6R25WCPQ5ZUF02XHNPA65JMD8ZA2W4YRQN6UUWG+EX1XPK8Y6Q";
522+
assert!(matches!(
523+
check_fragment_delimiter(fragment),
524+
Err(ParseFragmentError::AmbiguousDelimiter)
525+
));
526+
}
516527
}

0 commit comments

Comments
 (0)