From 9d76a9ebbc01a4c3492dacd429cf047d9204ea3c Mon Sep 17 00:00:00 2001 From: Raul Gutierrez S Date: Sat, 24 Jan 2015 08:31:42 -0800 Subject: [PATCH] Fix tests for nightly Signed-off-by: Raul Gutierrez S --- src/tests.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests.rs b/src/tests.rs index 82e1dff5b..498aeefe2 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -145,8 +145,8 @@ fn parse_test_data(input: &str) -> Vec { continue } let colon = piece.find(':').unwrap(); - let value = unescape(piece.slice_from(colon + 1)); - match piece.slice_to(colon) { + let value = unescape(&piece[colon + 1..]); + match &piece[..colon] { "s" => test.scheme = Some(value), "u" => test.username = value, "pass" => test.password = Some(value), @@ -207,7 +207,7 @@ fn file_paths() { assert_eq!(Url::from_file_path(&path::windows::Path::new(r"\drive-relative")), Err(())); assert_eq!(Url::from_file_path(&path::windows::Path::new(r"\\ucn\")), Err(())); - let mut url = Url::from_file_path(&path::posix::Path::new("/foo/bar")).unwrap(); + let mut url = Url::from_file_path(&path::posix::Path::new("/foo/bar")).ok().unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); assert_eq!(url.path(), Some(["foo".to_string(), "bar".to_string()].as_slice())); assert!(url.to_file_path() == Ok(path::posix::Path::new("/foo/bar"))); @@ -223,7 +223,7 @@ fn file_paths() { assert!(url.to_file_path() == Ok(path::posix::Path::new( /* note: byte string, invalid UTF-8 */ b"/foo/ba\x80r"))); - let mut url = Url::from_file_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap(); + let mut url = Url::from_file_path(&path::windows::Path::new(r"C:\foo\bar")).ok().unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); assert_eq!(url.path(), Some(["C:".to_string(), "foo".to_string(), "bar".to_string()].as_slice())); assert!(url.to_file_path::() @@ -250,11 +250,11 @@ fn directory_paths() { assert_eq!(Url::from_directory_path(&path::windows::Path::new(r"\drive-relative")), Err(())); assert_eq!(Url::from_directory_path(&path::windows::Path::new(r"\\ucn\")), Err(())); - let url = Url::from_directory_path(&path::posix::Path::new("/foo/bar")).unwrap(); + let url = Url::from_directory_path(&path::posix::Path::new("/foo/bar")).ok().unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); assert_eq!(url.path(), Some(["foo".to_string(), "bar".to_string(), "".to_string()].as_slice())); - let url = Url::from_directory_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap(); + let url = Url::from_directory_path(&path::windows::Path::new(r"C:\foo\bar")).ok().unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); assert_eq!(url.path(), Some([ "C:".to_string(), "foo".to_string(), "bar".to_string(), "".to_string()].as_slice()));