Skip to content

Commit

Permalink
failing test that fragments aren't parsed for params
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingmuch committed Oct 24, 2024
1 parent 7f69b6b commit 2203d3c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,16 @@ mod tests {
assert!(uri.message.is_none());
assert_eq!(uri.to_string(), "bitcoin:1andreas3batLhQa2FawWjeyjCqyBzypd?label=foo");
}

#[test]
fn rfc3986_non_empty_fragment_not_defined_in_bip21() {
let input = "bitcoin:1andreas3batLhQa2FawWjeyjCqyBzypd?label=foo#&message=not%20part%20of%20a%20message";
let uri = input.parse::<Uri<'_, _>>().unwrap().require_network(bitcoin::Network::Bitcoin).unwrap();
let label: Cow<'_, str> = uri.label.clone().unwrap().try_into().unwrap();
assert_eq!(uri.address.to_string(), "1andreas3batLhQa2FawWjeyjCqyBzypd");
assert_eq!(label, "foo");
assert!(uri.amount.is_none());
assert!(uri.message.is_none());
assert_eq!(uri.to_string(), "bitcoin:1andreas3batLhQa2FawWjeyjCqyBzypd?label=foo");
}
}

0 comments on commit 2203d3c

Please sign in to comment.