Auto merge of #5776 - servo:split-unit-tests, r=mbrubeck

Closes #5707. (Includes a rebase of it.)
Fixes #5688.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5776)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-04-21 14:06:22 -05:00
commit f795440ee3
16 changed files with 210 additions and 109 deletions

12
tests/unit/gfx/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "gfx_tests"
version = "0.0.1"
authors = ["The Servo Project Developers"]
[lib]
name = "gfx_tests"
path = "lib.rs"
doctest = false
[dependencies.gfx]
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;

26
tests/unit/net/Cargo.toml Normal file
View file

@ -0,0 +1,26 @@
[package]
name = "net_tests"
version = "0.0.1"
authors = ["The Servo Project Developers"]
[lib]
name = "net_tests"
path = "lib.rs"
doctest = false
[dependencies.net]
path = "../../../components/net"
[dependencies.net_traits]
path = "../../../components/net_traits"
[dependencies.profile]
path = "../../../components/profile"
[dependencies.util]
path = "../../../components/util"
[dependencies]
cookie = "*"
hyper = "*"
url = "*"

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

@ -1,9 +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 cookie;
mod data_loader;
mod image_cache_task;
mod mime_classifier;
mod resource_task;

View file

@ -0,0 +1,12 @@
[package]
name = "script_tests"
version = "0.0.1"
authors = ["The Servo Project Developers"]
[lib]
name = "script_tests"
path = "lib.rs"
doctest = false
[dependencies.script]
path = "../../../components/script"

View file

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

View file

@ -1,50 +1,33 @@
[package]
name = "unit_tests"
name = "style_tests"
version = "0.0.1"
authors = ["The Servo Project Developers"]
[lib]
name = "unit_tests"
name = "style_tests"
path = "lib.rs"
doctest = false
[dependencies.util]
path = "../../components/util"
[dependencies.gfx]
path = "../../components/gfx"
[dependencies.net]
path = "../../components/net"
[dependencies.net_traits]
path = "../../components/net_traits"
[dependencies.profile]
path = "../../components/profile"
[dependencies.style]
path = "../../components/style"
path = "../../../components/style"
[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.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"

View file

@ -3,25 +3,26 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(plugin)]
#![cfg_attr(test, feature(net, alloc, path, io))]
#![plugin(string_cache_plugin)]
extern crate cssparser;
extern crate geom;
extern crate gfx;
extern crate net;
extern crate net_traits;
extern crate profile;
extern crate script;
extern crate selectors;
extern crate string_cache;
extern crate style;
extern crate util;
extern crate url;
extern crate util;
#[cfg(test)] #[path="gfx/mod.rs"] mod gfx_tests;
#[cfg(test)] #[path="net/mod.rs"] mod net_tests;
#[cfg(test)] #[path="script/mod.rs"] mod script_tests;
#[cfg(test)] #[path="style/mod.rs"] mod style_tests;
#[cfg(test)] #[path="util/mod.rs"] mod util_tests;
#[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

@ -0,0 +1,15 @@
[package]
name = "util_tests"
version = "0.0.1"
authors = ["The Servo Project Developers"]
[lib]
name = "util_tests"
path = "lib.rs"
doctest = false
[dependencies.util]
path = "../../../components/util"
[dependencies.geom]
git = "https://github.com/servo/rust-geom"

View file

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