aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-04-16 11:29:58 +0200
committerMs2ger <ms2ger@gmail.com>2015-04-16 11:29:58 +0200
commit9be71b941fc43b15d4f5b50ebba772c8430c601c (patch)
tree53b70e5e7fa63800c7e1501eeb48f5fcf08e34a1 /tests
parent306da57b0768da818b562cd46f48e95df34dee48 (diff)
downloadservo-9be71b941fc43b15d4f5b50ebba772c8430c601c.tar.gz
servo-9be71b941fc43b15d4f5b50ebba772c8430c601c.zip
Remove the remaining traces of content tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/content/harness.js106
-rw-r--r--tests/contenttest.rs129
2 files changed, 0 insertions, 235 deletions
diff --git a/tests/content/harness.js b/tests/content/harness.js
deleted file mode 100644
index 452c72fa67d..00000000000
--- a/tests/content/harness.js
+++ /dev/null
@@ -1,106 +0,0 @@
-function _oneline(x) {
- var i = x.indexOf("\n");
- return (i == -1) ? x : (x.slice(0, i) + "...");
-}
-
-var _expectations = 0;
-var _tests = 0;
-function expect(num) {
- _expectations = num;
-}
-
-function _fail(s, m) {
- _tests++;
- // string split to avoid problems with tests that end up printing the value of window._fail.
- window.alert(_oneline("TEST-UNEXPECTED" + "-FAIL | " + s + ": " + m));
-}
-
-function _pass(s, m) {
- _tests++;
- window.alert(_oneline("TEST-PASS | " + s + ": " + m));
-}
-
-function _printer(opstr, op) {
- return function (a, b, msg) {
- var f = op(a,b) ? _pass : _fail;
- if (!msg) msg = "";
- f(a + " " + opstr + " " + b, msg);
- };
-}
-
-var is = _printer("===", function (a,b) { return a === b; });
-var is_not = _printer("!==", function (a,b) { return a !== b; });
-var is_a = _printer("is a", function (a,b) { return a instanceof b; });
-var is_not_a = _printer("is not a", function (a,b) { return !(a instanceof b); });
-var is_in = _printer("is in", function (a,b) { return a in b; });
-var is_not_in = _printer("is not in", function (a,b) { return !(a in b); });
-var as_str_is = _printer("as string is", function (a,b) { return String(a) == b; });
-var lt = _printer("<", function (a,b) { return a < b; });
-var gt = _printer(">", function (a,b) { return a > b; });
-var leq = _printer("<=", function (a,b) { return a <= b; });
-var geq = _printer(">=", function (a,b) { return a >= b; });
-var starts_with = _printer("starts with", function (a,b) { return a.indexOf(b) == 0; });
-
-function is_function(val, name) {
- starts_with(String(val), "function " + name + "(");
-}
-
-function should_throw(f) {
- try {
- f();
- _fail("operation should have thrown but did not");
- } catch (x) {
- _pass("operation successfully threw an exception", x.toString());
- }
-}
-
-function should_not_throw(f) {
- try {
- f();
- _pass("operation did not throw an exception");
- } catch (x) {
- _fail("operation should have not thrown", x.toString());
- }
-}
-
-function check_selector(elem, selector, matches) {
- is(elem.matches(selector), matches);
-}
-
-function check_disabled_selector(elem, disabled) {
- check_selector(elem, ":disabled", disabled);
- check_selector(elem, ":enabled", !disabled);
-}
-
-var _test_complete = false;
-var _test_timeout = 10000; //10 seconds
-function finish() {
- if (_test_complete) {
- _fail('finish called multiple times');
- }
- if (_expectations > _tests) {
- _fail('expected ' + _expectations + ' tests, fullfilled ' + _tests);
- }
- _test_complete = true;
- window.close();
-}
-
-function _test_timed_out() {
- if (!_test_complete) {
- _fail('test timed out (' + _test_timeout/1000 + 's)');
- finish();
- }
-}
-
-setTimeout(_test_timed_out, _test_timeout);
-
-var _needs_finish = false;
-function waitForExplicitFinish() {
- _needs_finish = true;
-}
-
-addEventListener('load', function() {
- if (!_needs_finish) {
- finish();
- }
-});
diff --git a/tests/contenttest.rs b/tests/contenttest.rs
deleted file mode 100644
index 67e24187b96..00000000000
--- a/tests/contenttest.rs
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(collections)]
-#![feature(exit_status)]
-#![feature(path)]
-#![feature(rustc_private)]
-#![feature(std_misc)]
-#![feature(test)]
-
-extern crate getopts;
-extern crate test;
-
-use test::{AutoColor, TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName};
-use test::ShouldPanic;
-use getopts::{getopts, reqopt};
-use std::{str, env};
-use std::ffi::OsStr;
-use std::fs::read_dir;
-use std::process::{Command, Stdio};
-use std::thunk::Thunk;
-
-#[derive(Clone)]
-struct Config {
- source_dir: String,
- filter: Option<String>
-}
-
-fn main() {
- let args = env::args();
- let config = parse_config(args.collect());
- let opts = test_options(config.clone());
- let tests = find_tests(config);
- match run_tests_console(&opts, tests) {
- Ok(false) => env::set_exit_status(1), // tests failed
- Err(_) => env::set_exit_status(2), // I/O-related failure
- _ => (),
- }
-}
-
-fn parse_config(args: Vec<String>) -> Config {
- let args = args.tail();
- let opts = vec!(reqopt("s", "source-dir", "source-dir", "source-dir"));
- let matches = match getopts(args, &opts) {
- Ok(m) => m,
- Err(f) => panic!(f.to_string())
- };
-
- Config {
- source_dir: matches.opt_str("source-dir").unwrap(),
- filter: matches.free.first().map(|s| s.clone())
- }
-}
-
-fn test_options(config: Config) -> TestOpts {
- TestOpts {
- filter: config.filter,
- run_ignored: false,
- run_tests: true,
- run_benchmarks: false,
- logfile: None,
- nocapture: false,
- color: AutoColor,
- }
-}
-
-fn find_tests(config: Config) -> Vec<TestDescAndFn> {
- read_dir(&config.source_dir)
- .ok()
- .expect("Error reading directory.")
- .filter_map(Result::ok)
- .map(|e| e.path())
- .filter(|file| file.extension().map_or(false, |e| e == OsStr::from_str("html")))
- .map(|file| make_test(file.display().to_string()))
- .collect()
-}
-
-fn make_test(file: String) -> TestDescAndFn {
- TestDescAndFn {
- desc: TestDesc {
- name: DynTestName(file.clone()),
- ignore: false,
- should_panic: ShouldPanic::No,
- },
- testfn: DynTestFn(Thunk::new(move || { run_test(file) }))
- }
-}
-
-fn run_test(file: String) {
- let path = env::current_dir().unwrap().join(&file);
- // FIXME (#1094): not the right way to transform a path
- let infile = format!("file://{}", path.display());
- let args = ["-z", "-f", &*infile];
-
- let mut prc_arg = env::current_exe().unwrap();
- let prc_arg = match prc_arg.pop() {
- true => prc_arg.join("servo"),
- _ => panic!("could not pop directory"),
- };
- let output = match Command::new(prc_arg.to_str().unwrap())
- .args(&args)
- .stdin(Stdio::null())
- .stderr(Stdio::inherit())
- .output()
- {
- Ok(p) => p,
- _ => panic!("Unable to spawn process."),
- };
-
- print!("{}", str::from_utf8(&output.stdout).unwrap());
-
- let out = str::from_utf8(&output.stderr);
- let lines: Vec<&str> = out.unwrap().split('\n').collect();
- for &line in lines.iter() {
- if line.contains("TEST-UNEXPECTED-FAIL") {
- panic!(line.to_string());
- }
- }
-
- if !output.status.success() {
- panic!("Servo exited with non-zero status {:?}", output.status);
- }
-}