• Home
  • Raw
  • Download

Lines Matching full:url

1 // Copyright 2013-2014 The rust-url developers.
15 use url::{quirks, Url};
19 // Copied form https://github.com/w3c/web-platform-tests/blob/master/url/ in urltestdata()
33 let base = match Url::parse(&base) { in urltestdata()
47 let url = match (base.join(&input), failure) { in urltestdata() localVariable
48 (Ok(url), false) => url, in urltestdata()
53 &format!("parse URL for {:?}", input), in urltestdata()
61 format!(" failed: expected parse error for URL {:?}", input), in urltestdata()
62 &format!("parse URL for {:?}", input), in urltestdata()
70 passed &= check_invariants(&url, &format!("invariants for {:?}", input), None); in urltestdata()
75 get(&url, attr), in urltestdata()
84 &quirks::origin(&url), in urltestdata()
114 let mut url = Url::parse(&href).unwrap(); in setters_tests() localVariable
116 passed &= check_invariants(&url, &name, comment_ref); in setters_tests()
117 let _ = set(&mut url, attr, &new_value); in setters_tests()
121 passed &= test_eq_eprint(value.string(), get(&url, attr), &name, comment_ref); in setters_tests()
125 passed &= check_invariants(&url, &name, comment_ref); in setters_tests()
132 fn check_invariants(url: &Url, name: &str, comment: Option<&str>) -> bool { in check_invariants() argument
134 if let Err(e) = url.check_invariants() { in check_invariants()
145 let bytes = serde_json::to_vec(url).unwrap(); in check_invariants()
146 let new_url: Url = serde_json::from_slice(&bytes).unwrap(); in check_invariants()
147 passed &= test_eq_eprint(url.to_string(), &new_url.to_string(), name, comment); in check_invariants()
177 fn get<'a>(url: &'a Url, attr: &str) -> &'a str { in get() argument
179 "href" => quirks::href(url), in get()
180 "protocol" => quirks::protocol(url), in get()
181 "username" => quirks::username(url), in get()
182 "password" => quirks::password(url), in get()
183 "hostname" => quirks::hostname(url), in get()
184 "host" => quirks::host(url), in get()
185 "port" => quirks::port(url), in get()
186 "pathname" => quirks::pathname(url), in get()
187 "search" => quirks::search(url), in get()
188 "hash" => quirks::hash(url), in get()
194 fn set<'a>(url: &'a mut Url, attr: &str, new: &str) { in set() argument
196 "protocol" => quirks::set_protocol(url, new), in set()
197 "username" => quirks::set_username(url, new), in set()
198 "password" => quirks::set_password(url, new), in set()
199 "hostname" => quirks::set_hostname(url, new), in set()
200 "host" => quirks::set_host(url, new), in set()
201 "port" => quirks::set_port(url, new), in set()
202 "pathname" => Ok(quirks::set_pathname(url, new)), in set()
203 "search" => Ok(quirks::set_search(url, new)), in set()
204 "hash" => Ok(quirks::set_hash(url, new)), in set()