diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 5b0894744860..ac9d4b389f97 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -353,7 +353,7 @@ fn get_scheme(rawurl: ~str) -> result::result<(~str, ~str), @~str> { } } }; - return result::ok((copy rawurl, ~"")); + return result::err(@~"url: Scheme must be terminated with a colon."); } // returns userinfo, host, port, and unparsed part, or an error @@ -779,6 +779,11 @@ mod tests { assert option::unwrap(copy u.fragment) == ~"something"; } + #[test] + fn test_no_scheme() { + assert result::is_err(get_scheme(~"noschemehere.html")); + } + #[test] fn test_invalid_scheme_errors() { assert result::is_err(from_str(~"99://something"));