Fix up the splitting of the unit tests crate.

Closes #5707. (Includes a rebase of it.)
Fixes #5688.
This commit is contained in:
Simon Sapin 2015-04-21 18:24:11 +02:00
parent 7b9c9e1453
commit ce1f2bab7b
15 changed files with 156 additions and 139 deletions

View file

@ -9,21 +9,4 @@ path = "lib.rs"
doctest = false
[dependencies.gfx]
path = "../../components/gfx"
[dependencies.profile]
path = "../../components/profile"
[dependencies.geom]
git = "https://github.com/servo/rust-geom"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache"
[dependencies]
cookie = "*"
url = "*"
hyper = "0.3"
path = "../../../components/gfx"

View file

@ -2,4 +2,6 @@
* 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/. */
mod text_util;
extern crate gfx;
#[cfg(test)] mod text_util;

View file

@ -9,24 +9,18 @@ path = "lib.rs"
doctest = false
[dependencies.net]
path = "../../components/net"
path = "../../../components/net"
[dependencies.net_traits]
path = "../../components/net_traits"
path = "../../../components/net_traits"
[dependencies.cssparser]
git = "https://github.com/servo/rust-cssparser"
[dependencies.profile]
path = "../../../components/profile"
[dependencies.selectors]
git = "https://github.com/servo/rust-selectors"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache"
[dependencies.util]
path = "../../../components/util"
[dependencies]
cookie = "*"
hyper = "*"
url = "*"
hyper = "0.3"

17
tests/unit/net/lib.rs Normal file
View file

@ -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/. */
#![cfg_attr(test, feature(net, alloc, path, io))]
extern crate net;
extern crate net_traits;
extern crate profile;
extern crate url;
extern crate util;
#[cfg(test)] mod cookie;
#[cfg(test)] mod data_loader;
#[cfg(test)] mod image_cache_task;
#[cfg(test)] mod mime_classifier;
#[cfg(test)] mod resource_task;

View file

@ -23,7 +23,7 @@ fn read_file(path: &path::Path) -> io::Result<Vec<u8>> {
fn test_sniff_mp4_matcher() {
let matcher = Mp4Matcher;
let p = PathBuf::new("../../tests/unit/net/parsable_mime/video/mp4/test.mp4");
let p = PathBuf::new("parsable_mime/video/mp4/test.mp4");
let read_result = read_file(&p);
match read_result {
@ -43,7 +43,7 @@ fn test_sniff_full(filename_orig: &path::Path,type_string: &str,subtype_string:
let current_working_directory = env::current_dir().unwrap();
println!("The current directory is {}", current_working_directory.display());
let mut filename = PathBuf::new("../../tests/unit/net/parsable_mime/");
let mut filename = PathBuf::new("parsable_mime/");
filename.push(filename_orig);
let classifier = MIMEClassifier::new();

View file

@ -9,24 +9,4 @@ path = "lib.rs"
doctest = false
[dependencies.script]
path = "../../components/script"
[dependencies.geom]
git = "https://github.com/servo/rust-geom"
[dependencies.cssparser]
git = "https://github.com/servo/rust-cssparser"
[dependencies.selectors]
git = "https://github.com/servo/rust-selectors"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache"
[dependencies]
cookie = "*"
url = "*"
hyper = "0.3"
path = "../../../components/script"

View file

@ -2,8 +2,7 @@
* 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/. */
mod cookie;
mod data_loader;
mod image_cache_task;
mod mime_classifier;
mod resource_task;
extern crate script;
#[cfg(all(test, target_pointer_width = "64"))] mod size_of;
#[cfg(test)] mod textinput;

View file

@ -8,19 +8,26 @@ name = "style_tests"
path = "lib.rs"
doctest = false
[dependencies.script]
path = "../../components/script"
[dependencies.style]
path = "../../../components/style"
[dependencies.selectors]
git = "https://github.com/servo/rust-selectors"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.util]
path = "../../../components/util"
[dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.geom]
git = "https://github.com/servo/rust-geom"
[dependencies.selectors]
git = "https://github.com/servo/rust-selectors"
[dependencies.cssparser]
git = "https://github.com/servo/rust-cssparser"
[dependencies]
cookie = "*"
url = "*"
hyper = "0.3"

28
tests/unit/style/lib.rs Normal file
View file

@ -0,0 +1,28 @@
/* 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/. */
#![feature(plugin)]
#![plugin(string_cache_plugin)]
extern crate cssparser;
extern crate geom;
extern crate selectors;
extern crate string_cache;
extern crate style;
extern crate url;
extern crate util;
#[cfg(test)] mod stylesheets;
#[cfg(test)] mod media_queries;
#[cfg(test)] mod writing_modes {
use util::logical_geometry::WritingMode;
use style::properties::{INITIAL_VALUES, get_writing_mode};
#[test]
fn initial_writing_mode_is_empty() {
assert_eq!(get_writing_mode(INITIAL_VALUES.get_inheritedbox()), WritingMode::empty())
}
}

View file

@ -1,16 +0,0 @@
/* 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 util::logical_geometry::WritingMode;
use style::properties::{INITIAL_VALUES, get_writing_mode};
mod stylesheets;
mod media_queries;
#[test]
fn initial_writing_mode_is_empty() {
assert_eq!(get_writing_mode(INITIAL_VALUES.get_inheritedbox()), WritingMode::empty())
}

View file

@ -9,21 +9,7 @@ path = "lib.rs"
doctest = false
[dependencies.util]
path = "../../components/util"
path = "../../../components/util"
[dependencies.cssparser]
git = "https://github.com/servo/rust-cssparser"
[dependencies.selectors]
git = "https://github.com/servo/rust-selectors"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache"
[dependencies]
cookie = "*"
url = "*"
hyper = "0.3"
[dependencies.geom]
git = "https://github.com/servo/rust-geom"

View file

@ -2,5 +2,10 @@
* 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/. */
#[cfg(target_pointer_width = "64")] mod size_of;
mod textinput;
extern crate util;
extern crate geom;
#[cfg(test)] mod cache;
#[cfg(test)] mod logical_geometry;
#[cfg(test)] mod task;
#[cfg(test)] mod vec;

View file

@ -1,8 +0,0 @@
/* 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/. */
mod cache;
mod logical_geometry;
mod task;
mod vec;