diff --git a/.gitignore b/.gitignore index a036e91f472..38b1b84c376 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ servo-test Makefile Servo.app -build +build* objdir config.mk config.stamp diff --git a/src/test/html/content/harness.js b/src/test/html/content/harness.js index a7da6e7cd6e..0697376df4f 100644 --- a/src/test/html/content/harness.js +++ b/src/test/html/content/harness.js @@ -1,22 +1,39 @@ +function _oneline(x) { + var i = x.indexOf("\n"); + return (i == -1) ? x : (x.slice(0, i) + "..."); +} + function _fail(s, m) { // string split to avoid problems with tests that end up printing the value of window._fail. - window.alert("TEST-UNEXPECTED" + "-FAIL | " + s + ": " + m); + window.alert(_oneline("TEST-UNEXPECTED" + "-FAIL | " + s + ": " + m)); } function _pass(s, m) { - window.alert("TEST-PASS | " + s + ": " + m); + window.alert(_oneline("TEST-PASS | " + s + ": " + m)); } -function is(a, b, c) { - let f = a != b ? _fail : _pass; - let m = !c ? "" : c; - f(a + " == " + b, m); +function _printer(opstr, op) { + return function (a, b, msg) { + let f = op(a,b) ? _pass : _fail; + if (!msg) msg = ""; + f(a + " " + opstr + " " + b, msg); + }; } -function isnot(a, b, c) { - let f = (a != b) ? _pass : _fail; - let m = !c ? "" : c; - f(a + " != " + b, m); +var is = _printer("==", function (a,b) { return a == b; }); +var is_a = _printer("is 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 isnot = _printer("!=", function (a,b) { return 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 + "("); } var _test_complete = false; diff --git a/src/test/html/content/test_DOMParser.html b/src/test/html/content/test_DOMParser.html new file mode 100644 index 00000000000..50c3b4f4f5f --- /dev/null +++ b/src/test/html/content/test_DOMParser.html @@ -0,0 +1,12 @@ + +
+ + + + diff --git a/src/test/html/content/test_Event.html b/src/test/html/content/test_Event.html new file mode 100644 index 00000000000..6b24d46daab --- /dev/null +++ b/src/test/html/content/test_Event.html @@ -0,0 +1,21 @@ + + + + + + diff --git a/src/test/html/content/test_MouseEvent.html b/src/test/html/content/test_MouseEvent.html new file mode 100644 index 00000000000..2fb8d413e88 --- /dev/null +++ b/src/test/html/content/test_MouseEvent.html @@ -0,0 +1,22 @@ + + + + + + diff --git a/src/test/html/content/test_childnodes.html b/src/test/html/content/test_childnodes.html index f8a4d9797c6..205a6124959 100644 --- a/src/test/html/content/test_childnodes.html +++ b/src/test/html/content/test_childnodes.html @@ -18,11 +18,11 @@ var child2 = document.createElement("p"); elem.appendChild(child2); - is(1 in children, true); + is_in(1, children); is(children.length, 2); is(children.item(1), child2); - is(!(2 in children), true); + is_not_in(2, children); is(children.item(2), null); finish(); diff --git a/src/test/html/content/test_collections.html b/src/test/html/content/test_collections.html new file mode 100644 index 00000000000..93837eb0c86 --- /dev/null +++ b/src/test/html/content/test_collections.html @@ -0,0 +1,140 @@ + + +pppppppppp
+qqqqqqqqqqqqqqqqqqqqqqqqqqq+ + + + +
head |
---|
data |
pre+ + + +
diff --git a/src/test/html/content/test_documentElement.html b/src/test/html/content/test_documentElement.html new file mode 100644 index 00000000000..0c38828084e --- /dev/null +++ b/src/test/html/content/test_documentElement.html @@ -0,0 +1,14 @@ + +
+ + + +