mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Upgrade to rust-url 1.0 and hyper 0.9
This commit is contained in:
parent
305c283602
commit
7932ab6ac2
76 changed files with 524 additions and 888 deletions
|
@ -17,11 +17,11 @@ fn test_argument_parsing() {
|
|||
assert!(parse_url_or_filename(fake_cwd, "http://example.net:invalid").is_err());
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "http://example.net").unwrap();
|
||||
assert_eq!(url.scheme, "http");
|
||||
assert_eq!(url.scheme(), "http");
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar.html").unwrap();
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["foo", "bar.html"]);
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["foo", "bar.html"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -30,8 +30,8 @@ fn test_file_path_parsing() {
|
|||
let fake_cwd = Path::new(FAKE_CWD);
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "bar.html").unwrap();
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["fake", "cwd", "bar.html"]);
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["fake", "cwd", "bar.html"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -40,8 +40,8 @@ fn test_file_path_parsing() {
|
|||
let fake_cwd = Path::new(FAKE_CWD);
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "bar.html").unwrap();
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["C:", "fake", "cwd", "bar.html"]);
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["C:", "fake", "cwd", "bar.html"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -53,16 +53,17 @@ fn test_argument_parsing_special() {
|
|||
// '?' and '#' have a special meaning in URLs...
|
||||
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar?baz#buzz.html").unwrap();
|
||||
assert_eq!(&*url.to_file_path().unwrap(), Path::new("/foo/bar"));
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["foo", "bar"]);
|
||||
assert_eq!(url.query.unwrap(), "baz");
|
||||
assert_eq!(url.fragment.unwrap(), "buzz.html");
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["foo", "bar"]);
|
||||
assert_eq!(url.query(), Some("baz"));
|
||||
assert_eq!(url.fragment(), Some("buzz.html"));
|
||||
|
||||
// but not in file names.
|
||||
let url = parse_url_or_filename(fake_cwd, "./bar?baz#buzz.html").unwrap();
|
||||
assert_eq!(&*url.to_file_path().unwrap(), Path::new("/fake/cwd/bar?baz#buzz.html"));
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["fake", "cwd", "bar%3Fbaz%23buzz.html"]);
|
||||
assert!(url.query.is_none());
|
||||
assert!(url.fragment.is_none());
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(),
|
||||
["fake", "cwd", "bar%3Fbaz%23buzz.html"]);
|
||||
assert_eq!(url.query(), None);
|
||||
assert_eq!(url.fragment(), None);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue