• Home
  • Raw
  • Download

Lines Matching full:url

1 // Copyright 2013-2014 The rust-url developers.
16 use url::{form_urlencoded, Host, Origin, Url};
27 assert_eq!(size_of::<Url>(), size_of::<Option<Url>>()); in size()
32 let base: Url = "sc://%C3%B1".parse().unwrap(); in test_relative()
33 let url = base.join("/resources/testharness.js").unwrap(); in test_relative() localVariable
34 assert_eq!(url.as_str(), "sc://%C3%B1/resources/testharness.js"); in test_relative()
39 let base: Url = "sc://%C3%B1".parse().unwrap(); in test_relative_empty()
40 let url = base.join("").unwrap(); in test_relative_empty() localVariable
41 assert_eq!(url.as_str(), "sc://%C3%B1"); in test_relative_empty()
46 let mut url: Url = "data:space ?query".parse().unwrap(); in test_strip_trailing_spaces_from_opaque_path() localVariable
47 url.set_query(None); in test_strip_trailing_spaces_from_opaque_path()
48 assert_eq!(url.as_str(), "data:space"); in test_strip_trailing_spaces_from_opaque_path()
50 let mut url: Url = "data:space #hash".parse().unwrap(); in test_strip_trailing_spaces_from_opaque_path() localVariable
51 url.set_fragment(None); in test_strip_trailing_spaces_from_opaque_path()
52 assert_eq!(url.as_str(), "data:space"); in test_strip_trailing_spaces_from_opaque_path()
57 let mut base: Url = "moz://foo:bar@servo/baz".parse().unwrap(); in test_set_empty_host()
65 let mut base: Url = "file://server/share/foo/bar".parse().unwrap(); in test_set_empty_host()
69 let mut base: Url = "file://server/share/foo/bar".parse().unwrap(); in test_set_empty_host()
76 let mut base: Url = "moz://foo:bar@servo/baz".parse().unwrap(); in test_set_empty_username_and_password()
89 let mut base: Url = "moz://foo:bar@servo/baz".parse().unwrap(); in test_set_empty_password()
100 use url::quirks; in test_set_empty_hostname()
101 let mut base: Url = "moz://foo@servo/baz".parse().unwrap(); in test_set_empty_hostname()
104 "setting an empty hostname to a url with a username should fail" in test_set_empty_hostname()
109 "setting an empty hostname to a url with a password should fail" in test_set_empty_hostname()
118 let mut base: Url = "moz://example.com/path?query".parse().unwrap(); in test_set_empty_query()
133 let url = Url::from_file_path(Path::new($path)).unwrap(); localVariable
134 assert_eq!(url.host(), None);
135 assert_eq!(url.path(), $url_path);
136 assert_eq!(url.to_file_path(), Ok(PathBuf::from($path)));
144 assert_eq!(Url::from_file_path(Path::new("relative")), Err(())); in new_file_paths()
145 assert_eq!(Url::from_file_path(Path::new("../relative")), Err(())); in new_file_paths()
148 assert_eq!(Url::from_file_path(Path::new("relative")), Err(())); in new_file_paths()
149 assert_eq!(Url::from_file_path(Path::new(r"..\relative")), Err(())); in new_file_paths()
150 assert_eq!(Url::from_file_path(Path::new(r"\drive-relative")), Err(())); in new_file_paths()
151 assert_eq!(Url::from_file_path(Path::new(r"\\ucn\")), Err(())); in new_file_paths()
168 let url = Url::from_file_path(Path::new(OsStr::from_bytes(b"/foo/ba\x80r"))).unwrap(); in new_path_bad_utf8() localVariable
170 assert_eq!(url.to_file_path(), Ok(PathBuf::from(os_str))); in new_path_bad_utf8()
180 assert!(Url::parse("file:///C:/foo/ba%80r") in new_path_windows_fun()
187 assert!(Url::from_file_path(path).is_ok()); in new_path_windows_fun()
190 let url = Url::parse("file:///C%3A/foo/bar").unwrap(); in new_path_windows_fun() localVariable
191 assert_eq!(url.to_file_path(), Ok(PathBuf::from(r"C:\foo\bar"))); in new_path_windows_fun()
198 assert_eq!(Url::from_directory_path(Path::new("relative")), Err(())); in new_directory_paths()
199 assert_eq!(Url::from_directory_path(Path::new("../relative")), Err(())); in new_directory_paths()
201 let url = Url::from_directory_path(Path::new("/foo/bar")).unwrap(); in new_directory_paths() localVariable
202 assert_eq!(url.host(), None); in new_directory_paths()
203 assert_eq!(url.path(), "/foo/bar/"); in new_directory_paths()
206 assert_eq!(Url::from_directory_path(Path::new("relative")), Err(())); in new_directory_paths()
207 assert_eq!(Url::from_directory_path(Path::new(r"..\relative")), Err(())); in new_directory_paths()
209 Url::from_directory_path(Path::new(r"\drive-relative")), in new_directory_paths()
212 assert_eq!(Url::from_directory_path(Path::new(r"\\ucn\")), Err(())); in new_directory_paths()
214 let url = Url::from_directory_path(Path::new(r"C:\foo\bar")).unwrap(); in new_directory_paths() localVariable
215 assert_eq!(url.host(), None); in new_directory_paths()
216 assert_eq!(url.path(), "/C:/foo/bar/"); in new_directory_paths()
222 let mut special_url = "http://foobar.com".parse::<Url>().unwrap(); in path_backslash_fun()
226 let mut nonspecial_url = "thing://foobar.com".parse::<Url>().unwrap(); in path_backslash_fun()
233 assert!("http://testing.com/this".parse::<Url>().is_ok()); in from_str()
238 let url = Url::parse_with_params( in parse_with_params() localVariable
245 url.as_str(), in parse_with_params()
252 let url: Url = "file:a".parse().unwrap(); in issue_124() localVariable
253 assert_eq!(url.path(), "/a"); in issue_124()
254 let url: Url = "file:...".parse().unwrap(); in issue_124() localVariable
255 assert_eq!(url.path(), "/..."); in issue_124()
256 let url: Url = "file:..".parse().unwrap(); in issue_124() localVariable
257 assert_eq!(url.path(), "/"); in issue_124()
265 fn check_eq(a: &Url, b: &Url) { in test_equality() argument
275 fn url(s: &str) -> Url { in test_equality() function
282 let a: Url = url("https://example.com/"); in test_equality()
283 let b: Url = url("https://example.com:443/"); in test_equality()
287 let a: Url = url("http://example.com/"); in test_equality()
288 let b: Url = url("http://example.com:8080/"); in test_equality()
292 let a: Url = url("http://example.com/"); in test_equality()
293 let b: Url = url("https://example.com/"); in test_equality()
297 let a: Url = url("http://foo.com/"); in test_equality()
298 let b: Url = url("http://bar.com/"); in test_equality()
302 let a: Url = url("http://foo.com"); in test_equality()
303 let b: Url = url("http://foo.com/"); in test_equality()
310 assert_eq!(Url::parse(input).unwrap().host(), Some(host)); in host()
337 assert!(Url::parse("http://1.35.+33.49").is_err()); in host()
338 assert!(Url::parse("http://2..2.3").is_err()); in host()
339 assert!(Url::parse("http://42.0x1232131").is_err()); in host()
340 assert!(Url::parse("http://192.168.0.257").is_err()); in host()
350 // but https://url.spec.whatwg.org/#concept-ipv6-serializer specifies not to. in host_serialization()
354 Url::parse("http://[0::2]").unwrap().host_str(), in host_serialization()
358 Url::parse("http://[0::ffff:0:2]").unwrap().host_str(), in host_serialization()
365 assert!("http://goșu.ro".parse::<Url>().is_ok()); in test_idna()
367 Url::parse("http://☃.net/").unwrap().host(), in test_idna()
371 .parse::<Url>() in test_idna()
397 let url = Url::parse(input).unwrap(); in test_serialization() localVariable
398 assert_eq!(url.as_str(), result); in test_serialization()
441 /// https://github.com/servo/rust-url/issues/61
443 let mut url = Url::parse("http://mozilla.org").unwrap(); in issue_61() localVariable
444 url.set_scheme("https").unwrap(); in issue_61()
445 assert_eq!(url.port(), None); in issue_61()
446 assert_eq!(url.port_or_known_default(), Some(443)); in issue_61()
447 url.check_invariants().unwrap(); in issue_61()
453 /// https://github.com/servo/rust-url/issues/197
455 let mut url = Url::from_file_path("/").expect("Failed to parse path"); in issue_197() localVariable
456 url.check_invariants().unwrap(); in issue_197()
458 url, in issue_197()
459 Url::parse("file:///").expect("Failed to parse path + protocol") in issue_197()
461 url.path_segments_mut() in issue_197()
468 Url::parse("mailto:").unwrap().cannot_be_a_base(); in issue_241()
472 /// https://github.com/servo/rust-url/issues/222
474 let mut url: Url = "http://localhost:6767/foo/bar?a=b".parse().unwrap(); in append_trailing_slash() localVariable
475 url.check_invariants().unwrap(); in append_trailing_slash()
476 url.path_segments_mut().unwrap().push(""); in append_trailing_slash()
477 url.check_invariants().unwrap(); in append_trailing_slash()
478 assert_eq!(url.to_string(), "http://localhost:6767/foo/bar/?a=b"); in append_trailing_slash()
482 /// https://github.com/servo/rust-url/issues/227
484 let mut url: Url = "http://localhost:6767/foo/bar".parse().unwrap(); in extend_query_pairs_then_mutate() localVariable
485 url.query_pairs_mut() in extend_query_pairs_then_mutate()
487 url.check_invariants().unwrap(); in extend_query_pairs_then_mutate()
489 url.to_string(), in extend_query_pairs_then_mutate()
492 url.path_segments_mut().unwrap().push("some_other_path"); in extend_query_pairs_then_mutate()
493 url.check_invariants().unwrap(); in extend_query_pairs_then_mutate()
495 url.to_string(), in extend_query_pairs_then_mutate()
501 /// https://github.com/servo/rust-url/issues/222
503 let mut url: Url = "http://localhost:6767/foo/bar?a=b".parse().unwrap(); in append_empty_segment_then_mutate() localVariable
504 url.check_invariants().unwrap(); in append_empty_segment_then_mutate()
505 url.path_segments_mut().unwrap().push("").pop(); in append_empty_segment_then_mutate()
506 url.check_invariants().unwrap(); in append_empty_segment_then_mutate()
507 assert_eq!(url.to_string(), "http://localhost:6767/foo/bar?a=b"); in append_empty_segment_then_mutate()
511 /// https://github.com/servo/rust-url/issues/243
513 let mut url = Url::parse("https://example.net/hello").unwrap(); in test_set_host() localVariable
514 url.set_host(Some("foo.com")).unwrap(); in test_set_host()
515 assert_eq!(url.as_str(), "https://foo.com/hello"); in test_set_host()
516 assert!(url.set_host(None).is_err()); in test_set_host()
517 assert_eq!(url.as_str(), "https://foo.com/hello"); in test_set_host()
518 assert!(url.set_host(Some("")).is_err()); in test_set_host()
519 assert_eq!(url.as_str(), "https://foo.com/hello"); in test_set_host()
521 let mut url = Url::parse("foobar://example.net/hello").unwrap(); in test_set_host() localVariable
522 url.set_host(None).unwrap(); in test_set_host()
523 assert_eq!(url.as_str(), "foobar:/hello"); in test_set_host()
525 let mut url = Url::parse("foo://ș").unwrap(); in test_set_host() localVariable
526 assert_eq!(url.as_str(), "foo://%C8%99"); in test_set_host()
527 url.set_host(Some("goșu.ro")).unwrap(); in test_set_host()
528 assert_eq!(url.as_str(), "foo://go%C8%99u.ro"); in test_set_host()
532 // https://github.com/servo/rust-url/issues/166
538 assert_eq!(Url::parse("file://./foo").unwrap().domain(), Some(".")); in test_leading_dots()
542 /// https://github.com/servo/rust-url/issues/302
553 let origin = &Url::parse("http://example.net/").unwrap().origin(); in test_origin_hash()
556 Url::parse("http://example.net:80/").unwrap().origin(), in test_origin_hash()
557 Url::parse("http://example.net:81/").unwrap().origin(), in test_origin_hash()
558 Url::parse("http://example.net").unwrap().origin(), in test_origin_hash()
559 Url::parse("http://example.net/hello").unwrap().origin(), in test_origin_hash()
560 Url::parse("https://example.net").unwrap().origin(), in test_origin_hash()
561 Url::parse("ftp://example.net").unwrap().origin(), in test_origin_hash()
562 Url::parse("file://example.net").unwrap().origin(), in test_origin_hash()
563 Url::parse("http://user@example.net/").unwrap().origin(), in test_origin_hash()
564 Url::parse("http://user:pass@example.net/") in test_origin_hash()
577 let opaque_origin = Url::parse("file://example.net").unwrap().origin(); in test_origin_hash()
578 let same_opaque_origin = Url::parse("file://example.net").unwrap().origin(); in test_origin_hash()
579 let other_opaque_origin = Url::parse("file://other").unwrap().origin(); in test_origin_hash()
587 let origin = &Url::parse("http://example.net/").unwrap().origin(); in test_origin_blob_equality()
588 let blob_origin = &Url::parse("blob:http://example.net/").unwrap().origin(); in test_origin_blob_equality()
596 assert!(!&Url::parse("blob:malformed//").unwrap().origin().is_tuple()) in test_origin_opaque()
608 let origin = Url::parse(unicode_url).unwrap().origin(); in test_origin_unicode_serialization()
613 Url::parse("http://example.net/").unwrap().origin(), in test_origin_unicode_serialization()
614 Url::parse("http://example.net:80/").unwrap().origin(), in test_origin_unicode_serialization()
615 Url::parse("http://example.net:81/").unwrap().origin(), in test_origin_unicode_serialization()
616 Url::parse("http://example.net").unwrap().origin(), in test_origin_unicode_serialization()
617 Url::parse("http://example.net/hello").unwrap().origin(), in test_origin_unicode_serialization()
618 Url::parse("https://example.net").unwrap().origin(), in test_origin_unicode_serialization()
619 Url::parse("ftp://example.net").unwrap().origin(), in test_origin_unicode_serialization()
620 Url::parse("file://example.net").unwrap().origin(), in test_origin_unicode_serialization()
621 Url::parse("http://user@example.net/").unwrap().origin(), in test_origin_unicode_serialization()
622 Url::parse("http://user:pass@example.net/") in test_origin_unicode_serialization()
625 Url::parse("http://127.0.0.1").unwrap().origin(), in test_origin_unicode_serialization()
656 let url = url::Url::parse(url_string).unwrap(); in test_socket_addrs() localVariable
657 let addrs = url in test_socket_addrs()
658 .socket_addrs(|| match url.scheme() { in test_socket_addrs()
672 let mut no_base_url = Url::parse("mailto:test@example.net").unwrap(); in test_no_base_url()
688 let url = Url::parse("https://127.0.0.1/").unwrap(); in test_domain() localVariable
689 assert_eq!(url.domain(), None); in test_domain()
691 let url = Url::parse("mailto:test@example.net").unwrap(); in test_domain() localVariable
692 assert_eq!(url.domain(), None); in test_domain()
694 let url = Url::parse("https://example.com/").unwrap(); in test_domain() localVariable
695 assert_eq!(url.domain(), Some("example.com")); in test_domain()
700 let url = Url::parse("https://example.com/products?page=2#fragment").unwrap(); in test_query() localVariable
701 assert_eq!(url.query(), Some("page=2")); in test_query()
703 url.query_pairs().next(), in test_query()
707 let url = Url::parse("https://example.com/products").unwrap(); in test_query() localVariable
708 assert!(url.query().is_none()); in test_query()
709 assert_eq!(url.query_pairs().count(), 0); in test_query()
711 let url = Url::parse("https://example.com/?country=español").unwrap(); in test_query() localVariable
712 assert_eq!(url.query(), Some("country=espa%C3%B1ol")); in test_query()
714 url.query_pairs().next(), in test_query()
718 let url = Url::parse("https://example.com/products?page=2&sort=desc").unwrap(); in test_query() localVariable
719 assert_eq!(url.query(), Some("page=2&sort=desc")); in test_query()
720 let mut pairs = url.query_pairs(); in test_query()
734 let url = Url::parse("https://example.com/#fragment").unwrap(); in test_fragment() localVariable
735 assert_eq!(url.fragment(), Some("fragment")); in test_fragment()
737 let url = Url::parse("https://example.com/").unwrap(); in test_fragment() localVariable
738 assert_eq!(url.fragment(), None); in test_fragment()
743 let mut url = Url::parse("http://example.com").unwrap(); in test_set_ip_host() localVariable
745 url.set_ip_host("127.0.0.1".parse().unwrap()).unwrap(); in test_set_ip_host()
746 assert_eq!(url.host_str(), Some("127.0.0.1")); in test_set_ip_host()
748 url.set_ip_host("::1".parse().unwrap()).unwrap(); in test_set_ip_host()
749 assert_eq!(url.host_str(), Some("[::1]")); in test_set_ip_host()
754 use url::quirks::set_href; in test_set_href()
756 let mut url = Url::parse("https://existing.url").unwrap(); in test_set_href() localVariable
758 assert!(set_href(&mut url, "mal//formed").is_err()); in test_set_href()
761 &mut url, in test_set_href()
766 url, in test_set_href()
767 Url::parse("https://user:pass@domain.com:9742/path/file.ext?key=val&key2=val2#fragment") in test_set_href()
774 use url::quirks::{domain_to_ascii, domain_to_unicode}; in test_domain_encoding_quirks()
783 for url in &data { in test_domain_encoding_quirks()
784 assert_eq!(domain_to_ascii(url.0), url.1); in test_domain_encoding_quirks()
785 assert_eq!(domain_to_unicode(url.0), url.2); in test_domain_encoding_quirks()
792 use url::quirks::internal_components; in test_expose_internals()
793 use url::quirks::InternalComponents; in test_expose_internals()
795 let url = Url::parse("https://example.com/path/file.ext?key=val&key2=val2#fragment").unwrap(); in test_expose_internals() localVariable
805 } = internal_components(&url); in test_expose_internals()
820 let url = Url::from_file_path(Path::new(r"\\host\share\path\file.txt")).unwrap(); in test_windows_unc_path() localVariable
821 assert_eq!(url.as_str(), "file://host/share/path/file.txt"); in test_windows_unc_path()
823 let url = Url::from_file_path(Path::new(r"\\höst\share\path\file.txt")).unwrap(); in test_windows_unc_path() localVariable
824 assert_eq!(url.as_str(), "file://xn--hst-sna/share/path/file.txt"); in test_windows_unc_path()
826 let url = Url::from_file_path(Path::new(r"\\192.168.0.1\share\path\file.txt")).unwrap(); in test_windows_unc_path() localVariable
827 assert_eq!(url.host(), Some(Host::Ipv4(Ipv4Addr::new(192, 168, 0, 1)))); in test_windows_unc_path()
829 let path = url.to_file_path().unwrap(); in test_windows_unc_path()
833 let url = Url::from_file_path(Path::new(r"\\?\UNC\host\share\path\file.txt")).unwrap(); in test_windows_unc_path() localVariable
834 assert_eq!(url.as_str(), "file://host/share/path/file.txt"); in test_windows_unc_path()
837 let url = Url::from_file_path(Path::new(r"\\.\some\path\file.txt")); in test_windows_unc_path() localVariable
838 assert!(url.is_err()); in test_windows_unc_path()
843 use url::SyntaxViolation::*; in test_syntax_violation_callback()
845 let url = Url::options() in test_syntax_violation_callback() localVariable
849 assert_eq!(url.port(), Some(42)); in test_syntax_violation_callback()
859 use url::SyntaxViolation::*; in test_syntax_violation_callback_lifetimes()
863 let url = Url::options() in test_syntax_violation_callback_lifetimes() localVariable
867 assert_eq!(url.port(), Some(42)); in test_syntax_violation_callback_lifetimes()
870 let url = Url::options() in test_syntax_violation_callback_lifetimes() localVariable
874 assert_eq!(url.path(), "/path"); in test_syntax_violation_callback_lifetimes()
880 use url::SyntaxViolation::*; in test_syntax_violation_callback_types()
885 …ntials, "embedding authentication information (username or password) in an URL is not recommended"… in test_syntax_violation_callback_types()
889 ("http://mozilla.org/^", NonUrlCodePoint, "non-URL code point"), in test_syntax_violation_callback_types()
890 …("http://mozilla.org/#\x000", NullInFragment, "NULL characters are ignored in URL fragment identif… in test_syntax_violation_callback_types()
898 Url::options() in test_syntax_violation_callback_types()
912 use url::SyntaxViolation::*; in test_options_reuse()
916 let options = Url::options().syntax_violation_callback(Some(&vfn)); in test_options_reuse()
917 let url = options.parse("http:////mozilla.org").unwrap(); in test_options_reuse() localVariable
919 let options = options.base_url(Some(&url)); in test_options_reuse()
920 let url = options.parse("/sub\\path").unwrap(); in test_options_reuse() localVariable
921 assert_eq!(url.as_str(), "http://mozilla.org/sub/path"); in test_options_reuse()
925 /// https://github.com/servo/rust-url/issues/505
930 use url::Url; in test_url_from_file_path()
933 let u = Url::from_file_path(p).unwrap(); in test_url_from_file_path()
938 /// https://github.com/servo/rust-url/issues/505
944 use url::Url;
947 let u = Url::from_file_path(p).unwrap();
954 let mut db_url = url::Url::parse("postgres://postgres@localhost/").unwrap();
963 let mut db_url = url::Url::parse("postgres://postgres@localhost/").unwrap();
978 let mut db_url = url::Url::parse("postgres://postgres@localhost/").unwrap();
990 let mut url: Url = "http://localhost:6767/foo/bar".parse().unwrap(); localVariable
991 let result = url.set_scheme("file");
992 assert_eq!(url.to_string(), "http://localhost:6767/foo/bar");
998 let mut url = Url::parse("arhttpsps:/.//eom/dae.com/\\\\t\\:").unwrap(); localVariable
999 url::quirks::set_hostname(&mut url, "//eom/datcom/\\\\t\\://eom/data.cs").unwrap();
1004 // since Note in item 3 of URL serializing in the URL Standard
1005 // https://url.spec.whatwg.org/#url-serializing
1006 let url = Url::parse("m:/.//\\").unwrap(); localVariable
1007 let encoded = url.as_str();
1008 let reparsed = Url::parse(encoded).unwrap();
1009 assert_eq!(reparsed, url);
1014 let mut url = Url::parse("m://").unwrap(); localVariable
1015 let mut segments = url.path_segments_mut().unwrap();
1022 use url::Position::*;
1075 let url = Url::parse(expected_slices.full).unwrap(); localVariable
1076 assert_eq!(&url[..], expected_slices.full);
1077 assert_eq!(&url[BeforeScheme..AfterScheme], expected_slices.scheme);
1079 &url[BeforeUsername..AfterUsername],
1083 &url[BeforePassword..AfterPassword],
1086 assert_eq!(&url[BeforeHost..AfterHost], expected_slices.host);
1087 assert_eq!(&url[BeforePort..AfterPort], expected_slices.port);
1088 assert_eq!(&url[BeforePath..AfterPath], expected_slices.path);
1089 assert_eq!(&url[BeforeQuery..AfterQuery], expected_slices.query);
1091 &url[BeforeFragment..AfterFragment],
1094 assert_eq!(&url[..AfterFragment], expected_slices.full);
1199 let base_uri = url::Url::parse(base).unwrap();
1200 let relative_uri = url::Url::parse(uri).unwrap();
1225 let base_uri = url::Url::parse(base).unwrap();
1226 let relative_uri = url::Url::parse(uri).unwrap();
1234 let url = Url::parse("mailto:joe@example.com").unwrap(); localVariable
1235 assert!(!url.has_authority());
1236 let url = Url::parse("unix:/run/foo.socket").unwrap(); localVariable
1237 assert!(!url.has_authority());
1238 let url = Url::parse("file:///tmp/foo").unwrap(); localVariable
1239 assert!(url.has_authority());
1240 let url = Url::parse("http://example.com/tmp/foo").unwrap(); localVariable
1241 assert!(url.has_authority());
1246 let url = Url::parse("mailto:joe@example.com").unwrap(); localVariable
1247 assert_eq!(url.authority(), "");
1248 let url = Url::parse("unix:/run/foo.socket").unwrap(); localVariable
1249 assert_eq!(url.authority(), "");
1250 let url = Url::parse("file:///tmp/foo").unwrap(); localVariable
1251 assert_eq!(url.authority(), "");
1252 let url = Url::parse("http://example.com/tmp/foo").unwrap(); localVariable
1253 assert_eq!(url.authority(), "example.com");
1254 let url = Url::parse("ftp://127.0.0.1:21/").unwrap(); localVariable
1255 assert_eq!(url.authority(), "127.0.0.1");
1256 let url = Url::parse("ftp://user@127.0.0.1:2121/").unwrap(); localVariable
1257 assert_eq!(url.authority(), "user@127.0.0.1:2121");
1258 let url = Url::parse("https://:@example.com/").unwrap(); localVariable
1259 assert_eq!(url.authority(), "example.com");
1260 let url = Url::parse("https://:password@[::1]:8080/").unwrap(); localVariable
1261 assert_eq!(url.authority(), ":password@[::1]:8080");
1262 let url = Url::parse("gopher://user:@àlex.example.com:70").unwrap(); localVariable
1263 assert_eq!(url.authority(), "user@%C3%A0lex.example.com:70");
1264 let url = Url::parse("irc://àlex:àlex@àlex.рф.example.com:6667/foo").unwrap(); localVariable
1266 url.authority(),
1269 let url = Url::parse("https://àlex:àlex@àlex.рф.example.com:443/foo").unwrap(); localVariable
1271 url.authority(),
1277 /// https://github.com/servo/rust-url/issues/838
1280 let url = url::Url::parse(s1).unwrap(); localVariable
1281 assert_eq!(url.to_string(), "file:///p:?../");
1282 assert_eq!(url.path(), "/p:");
1294 let url2 = url::Url::join(&url, case.0).unwrap();
1304 let url = url::Url::parse(s1).unwrap(); localVariable
1305 assert_eq!(url.to_string(), "file:///p:/x|?../");
1306 assert_eq!(url.path(), "/p:/x|");
1308 let url2 = url::Url::join(&url, s2).unwrap();
1314 let mut url = url::Url::parse("file://").unwrap(); localVariable
1315 dbg!(&url);
1316 url.set_path("x");
1317 dbg!(&url);