From 36eb25161d7c1f78d81aa59204500d1860aed1fc Mon Sep 17 00:00:00 2001 From: Yoav Alon Date: Sun, 17 Apr 2016 23:02:33 +0300 Subject: [PATCH] added test for https://github.com/servo/servo/issues/10548 --- tests/unit/net/file_loader.rs | 17 +++++++++++++++++ tests/unit/net/lib.rs | 1 + 2 files changed, 18 insertions(+) create mode 100644 tests/unit/net/file_loader.rs diff --git a/tests/unit/net/file_loader.rs b/tests/unit/net/file_loader.rs new file mode 100644 index 00000000000..31d20812222 --- /dev/null +++ b/tests/unit/net/file_loader.rs @@ -0,0 +1,17 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::env; +use url::Url; + +#[test] +fn load_htm() { + let mut path = env::current_dir().expect("didn't get working dir"); + path.push("test.jpeg"); + + let canon_path = path.canonicalize().expect("file path doesn't exist"); + let url = Url::from_file_path(canon_path); + + assert!(url.is_ok()); +} diff --git a/tests/unit/net/lib.rs b/tests/unit/net/lib.rs index ee62fa2a40a..7de91fb7738 100644 --- a/tests/unit/net/lib.rs +++ b/tests/unit/net/lib.rs @@ -20,6 +20,7 @@ extern crate util; #[cfg(test)] mod cookie; #[cfg(test)] mod data_loader; +#[cfg(test)] mod file_loader; #[cfg(test)] mod fetch; #[cfg(test)] mod mime_classifier; #[cfg(test)] mod resource_thread;