We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f67bdcc commit 45f2f9fCopy full SHA for 45f2f9f
src/lib.rs
@@ -576,7 +576,20 @@ mod test {
576
assert_eq!(url.to_string(), expected);
577
}
578
579
-
+ #[test]
580
+ fn should_parse_with_try_from() {
581
+ let tests = [("http://example.com/", true), ("invalid url", false)];
582
+ for (value, should_parse) in tests {
583
+ let url = Url::parse("http://example.com/", None).unwrap();
584
+ let parsed = Url::try_from(value);
585
+ if should_parse {
586
+ assert_eq!(parsed.is_ok(), should_parse);
587
+ assert_eq!(url, parsed.unwrap());
588
+ } else {
589
+ assert!(parsed.is_err());
590
+ }
591
592
593
#[test]
594
fn should_compare_urls() {
595
let tests = [
0 commit comments