X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=build%2Ftest%2Fdata%2Ftestrunner.js;h=398ef3dcd4fe5f192eec71644b15a183f8106f2f;hb=b30a469a5a66d1e11fbe1fa0bcc30636a23d4d78;hp=a72a1c17c883b367be73ef3a9d7573791dd4c66c;hpb=b0c3711d3e8bd844d1cfa8569864df1c1f73180a;p=jquery.git diff --git a/build/test/data/testrunner.js b/build/test/data/testrunner.js index a72a1c1..398ef3d 100644 --- a/build/test/data/testrunner.js +++ b/build/test/data/testrunner.js @@ -8,6 +8,7 @@ var stats = { }; var queue = []; var blocking = false; +var timeout; function synchronize(callback) { queue[queue.length] = callback; @@ -26,9 +27,11 @@ function process() { function stop() { blocking = true; - setTimeout(start, asyncTimeout * 1000); + timeout = setTimeout(start, asyncTimeout * 1000); } function start() { + if(timeout) + clearTimeout(timeout); blocking = false; process(); } @@ -47,12 +50,12 @@ function runTest(tests) { } function test(name, callback) { - Test = []; synchronize(function() { + Test = []; try { callback(); } catch(e) { - if(typeof console != "undefined") { + if( typeof console != "undefined" && console.error && console.warn ) { console.error("Test " + name + " died, exception and test follows"); console.error(e); console.warn(callback.toString()); @@ -126,9 +129,10 @@ function isSet(a, b, msg) { ret = false; } else ret = false; - if ( !ret && console ) - console.log( msg, a, b ); - Test.push( [ ret, msg ] ); + if ( !ret ) + Test.push( [ ret, msg + " expected: " + b + " result: " + a ] ); + else + Test.push( [ ret, msg ] ); } /**