Skip to content

Commit

Permalink
switch to gh qunit; has asynch ops for timer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smparkes committed Oct 16, 2009
1 parent 75447dc commit ed73c2a
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 256 deletions.
5 changes: 2 additions & 3 deletions test/envjs-call-load-test.js
@@ -1,8 +1,6 @@

load("dist/env.rhino.js");
load("test/qunit.js");
Envjs("test/index.html", {});
load("test/testrunner.js");


test("'index.html' loaded correctly via 'Envjs()' call", function(){
expect(1);
Expand All @@ -16,3 +14,4 @@ test("window.location= following Envjs() initialization flagged as error",
expect(0);
});

Envjs.wait(0);
25 changes: 9 additions & 16 deletions test/primaryTests.js
@@ -1,19 +1,16 @@
load("test/qunit.js");

load("dist/env.rhino.js"); // Init


window.onload = function(){
print("\n\nTesting with '" + whichJarFile + "' JavaScript interpreter jar");
window.addEventListener("load",function(){
print("\n\nTesting with " + whichInterpreter);
print("Handling onload for test.js");
load("test/testrunner.js");
print("Loaded test runner. Loading tests.");
print("Loading tests.");

load(
"test/unit/dom.js",
"test/unit/window.js",
"test/unit/elementmembers.js"
);
if (whichJarFile == "envjs")
if (multiwindow)
load(
"test/unit/onload.js",
"test/unit/scope.js", // must come before frame.js changes page content
Expand All @@ -23,15 +20,11 @@ window.onload = function(){
);
load(
"test/unit/parser.js",
"test/unit/timer.js",

//NOTE: keep this test last because Prototype pollutes
//the namespace and several DOM objects
"test/unit/prototypecompat.js"
"test/unit/timer.js"
);

results(); // Display
};
print("Load complete. Running tests.");
});

window.location = "test/index.html";

Envjs.wait(0);
61 changes: 61 additions & 0 deletions test/qunit.js
@@ -0,0 +1,61 @@
load("test/qunit/qunit/qunit.js");

(function(){
var assertion_index = 0;

var module_index = 0;
var module;

var test_index = 0;
var test;

QUnit.moduleStart = function(m,te) {
module = m;
module_index++;
};

QUnit.moduleDone = function(t,f,tx) {
var s = module_index + ". module "+t+": ";
if ( f ) {
s += f + " failure(s) in " + tx + " tests";
} else {
s += "all " + tx + " tests successful";
}
// print(s);
module = undefined;
};

QUnit.testStart = function(t) {
test = t;
test_index++;
};

QUnit.testDone = function(t) {
test = undefined;
}

QUnit.log = function(r,m) {
assertion_index++;
var test_string = "";
if ( module || test ) {
var test_string = "[";
if ( module ) {
test_string += module;
if ( test ) {
test_string += ": ";
}
}
if ( test ) {
test_string += test;
}
test_string += "] ";
}
var s = ( r ? "PASS (" : "FAIL (" ) + assertion_index + ") " + test_string + m;
print(s);
};

QUnit.done = function(f,t) {
print((t-f) + " Passed, " + f + " Failed, " + t + " Total Tests" );
};

})(QUnit);
4 changes: 3 additions & 1 deletion test/test-with-envs-jar.js
Expand Up @@ -2,5 +2,7 @@
// version of the JS interpreter: env-js.jar

whichJarFile = "envjs";
whichInterpreter = whichJarFile + " interpreter jar";
multiwindow = true;
load("dist/env.rhino.js");
load("test/primaryTests.js");

5 changes: 4 additions & 1 deletion test/test-with-rhino-jar.js
@@ -1,6 +1,9 @@
// Run 'test.js', letting it know that we're running with the vanilla
// unmodified version of the Rhino JS interpreter: rhino.jar

whichJarFile = "rhino";
whichJarFile = "rhino"
whichInterpreter = whichJarFile + " interpreter jar";
multiwindow = false;
load("dist/env.rhino.js");
load("test/primaryTests.js");

235 changes: 0 additions & 235 deletions test/testrunner.js

This file was deleted.

0 comments on commit ed73c2a

Please sign in to comment.