Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

YUITest npm build

  • Loading branch information...
commit ddd63e54ba46d85fba812004a4b0c60c0af36815 1 parent cc8f87a
@davglass davglass authored
View
14 javascript/build/yuitest/npm/cli.js 100644 → 100755
@@ -43,16 +43,7 @@ YUITest.CLI = {
},
quit: function(code){
-
- //Workaround for https://github.com/joyent/node/issues/1669
- var flushed = process.stdout.flush && process.stdout.flush();
- if (!flushed && (parseFloat(process.versions.node) < 0.5)) {
- process.once("drain", function () {
- process.exit(code || 0);
- });
- } else {
- process.exit(code || 0);
- }
+ process.exit(code || 0);
},
isDirectory: function(name) {
@@ -513,6 +504,9 @@ YUITest.Util.mix(YUITest.CLI, {
this.processArguments();
this.processFiles();
+ YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT, function(event) {
+ YUITest.CLI.quit(event.results.failed ? 1 : 0);
+ });
YUITest.TestRunner.run({
groups: this.options.groups ? this.options.groups.split(",") : null
View
21 javascript/build/yuitest/npm/lib/yuitest-node.js
@@ -10,7 +10,7 @@
*/
var YUITest = exports;
-YUITest.version = "0.7.8";
+YUITest.version = "0.7.9";
//backwards compatibility
exports.YUITest = YUITest;
@@ -1995,7 +1995,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -3451,12 +3451,19 @@ YUITest.CoverageFormat = {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
View
2  javascript/build/yuitest/npm/package.json
@@ -1,6 +1,6 @@
{
"name": "yuitest",
- "version": "0.7.8",
+ "version": "0.7.9",
"description": "YUI Test Library on NodeJS",
"author": "Dav Glass <davglass@gmail.com>",
"url": { "web" : "http://yuilibrary.com/projects/yuitest/issues" },
View
21 javascript/build/yuitest/yuitest-core-debug.js
@@ -10,7 +10,7 @@
*/
var YUITest = {
- version: "0.7.8",
+ version: "0.7.9",
_idx: 0,
guid: function(pre) {
var id = (new Date()).getTime() + '_' + (++YUITest._idx);
@@ -1992,7 +1992,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -3448,12 +3448,19 @@ YUITest.CoverageFormat = {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
View
4 javascript/build/yuitest/yuitest-core-min.js
@@ -1,6 +1,6 @@
-var YUITest={version:"0.7.8",_idx:0,guid:function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;}};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();if(b!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be null."),null,b);
+var YUITest={version:"0.7.9",_idx:0,guid:function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;}};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();if(b!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be null."),null,b);
}},isUndefined:function(b,a){YUITest.Assert._increment();if(typeof b!="undefined"){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be undefined."),undefined,b);}},isArray:function(c,b){YUITest.Assert._increment();var a=false;if(Array.isArray){a=!Array.isArray(c);}else{a=Object.prototype.toString.call(c)!="[object Array]";}if(a){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Value should be an array."),c);}},isBoolean:function(b,a){YUITest.Assert._increment();if(typeof b!="boolean"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a Boolean."),b);}},isFunction:function(b,a){YUITest.Assert._increment();if(!(b instanceof Function)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a function."),b);}},isInstanceOf:function(b,c,a){YUITest.Assert._increment();if(!(c instanceof b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value isn't an instance of expected type."),b,c);}},isNumber:function(b,a){YUITest.Assert._increment();if(typeof b!="number"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a number."),b);}},isObject:function(b,a){YUITest.Assert._increment();if(!b||(typeof b!="object"&&typeof b!="function")){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be an object."),b);}},isString:function(b,a){YUITest.Assert._increment();if(typeof b!="string"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a string."),b);}},isTypeOf:function(a,c,b){YUITest.Assert._increment();if(typeof c!=a){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Value should be of type "+a+"."),a,typeof c);}},throwsError:function(d,e,c){YUITest.Assert._increment();var a=false;try{e();}catch(b){if(typeof d=="string"){if(b.message!=d){a=true;}}else{if(typeof d=="function"){if(!(b instanceof d)){a=true;}}else{if(typeof d=="object"&&d!==null){if(!(b instanceof d.constructor)||b.message!=d.message){a=true;}}else{a=true;}}}if(a){throw new YUITest.UnexpectedError(b);}else{return;}}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(c,"Error should have been thrown."));}};YUITest.ArrayAssert={_indexOf:function(b,c){if(b.indexOf){return b.indexOf(c);}else{for(var a=0;a<b.length;a++){if(b[a]===c){return a;}}return -1;}},_some:function(b,c){if(b.some){return b.some(c);}else{for(var a=0;a<b.length;a++){if(c(b[a])){return true;}}return false;}},contains:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value "+c+" ("+(typeof c)+") not found in array ["+b+"]."));}},containsItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value "+c[a]+" ("+(typeof c[a])+") not found in array ["+d+"]."));}}},containsMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"No match found in array ["+b+"]."));}},doesNotContain:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},doesNotContainItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value found in array ["+d+"]."));}}},doesNotContainMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},indexOf:function(e,d,a,c){YUITest.Assert._increment();for(var b=0;b<d.length;b++){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array ["+d+"]."));},itemsAreEqual:function(c,d,b){YUITest.Assert._increment();if(typeof c!="object"||typeof d!="object"){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value should be an array."));}if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length+"."));}for(var a=0;a<c.length;a++){if(c[a]!=d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not equal."),c[a],d[a]);}}},itemsAreEquivalent:function(d,e,a,c){YUITest.Assert._increment();if(typeof a!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(d.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Array should have a length of "+d.length+" but has a length of "+e.length));}for(var b=0;b<d.length;b++){if(!a(d[b],e[b])){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values in position "+b+" are not equivalent."),d[b],e[b]);}}},isEmpty:function(b,a){YUITest.Assert._increment();if(b.length>0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should be empty."));}},isNotEmpty:function(b,a){YUITest.Assert._increment();if(b.length===0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should not be empty."));}},itemsAreSame:function(c,d,b){YUITest.Assert._increment();if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length));}for(var a=0;a<c.length;a++){if(c[a]!==d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not the same."),c[a],d[a]);}}},lastIndexOf:function(e,d,a,c){for(var b=d.length;b>=0;b--){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));
}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array."));}};YUITest.ObjectAssert={areEqual:function(d,f,c){YUITest.Assert._increment();var b=YUITest.Object.keys(d),e=YUITest.Object.keys(f);if(b.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Object should have "+b.length+" keys but has "+e.length));}for(var a in d){if(d.hasOwnProperty(a)){if(d[a]!=f[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values should be equal for property "+a),d[a],f[a]);}}}},hasKey:function(a,b,c){YUITest.ObjectAssert.ownsOrInheritsKey(a,b,c);},hasKeys:function(b,a,c){YUITest.ObjectAssert.ownsOrInheritsKeys(b,a,c);},inheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b&&!b.hasOwnProperty(a))){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},inheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(propertyName in a&&!a.hasOwnProperty(c[b]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsKey:function(a,b,c){YUITest.Assert._increment();if(!b.hasOwnProperty(a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},ownsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!a.hasOwnProperty(c[b])){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsNoKeys:function(b,d){YUITest.Assert._increment();var c=0,a;for(a in b){if(b.hasOwnProperty(a)){c++;}}if(c!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Object owns "+c+" properties but should own none."));}},ownsOrInheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object."));}},ownsOrInheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(c[b] in a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getFullYear()!=d.getFullYear()){c="Years should be equal.";}if(b.getMonth()!=d.getMonth()){c="Months should be equal.";}if(b.getDate()!=d.getDate()){c="Days of month should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getHours()!=d.getHours()){c="Hours should be equal.";}if(b.getMinutes()!=d.getMinutes()){c="Minutes should be equal.";}if(b.getSeconds()!=d.getSeconds()){c="Seconds should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(d){d=d||{};var a,b;try{function e(){}e.prototype=d;a=new e();}catch(c){a={};}for(b in d){if(d.hasOwnProperty(b)){if(typeof d[b]=="function"){a[b]=function(f){return function(){YUITest.Assert.fail("Method "+f+"() was called but was not expected to be.");};}(b);}}}return a;};YUITest.Mock.expect=function(g,c){if(!g.__expectations){g.__expectations={};}if(c.method){var a=c.method,h=c.args||[],k=c.returns,f=(typeof c.callCount=="number")?c.callCount:1,j=c.error,d=c.run||function(){},b,e;g.__expectations[a]=c;c.callCount=f;c.actualCallCount=0;for(e=0;e<h.length;e++){if(!(h[e] instanceof YUITest.Mock.Value)){h[e]=YUITest.Mock.Value(YUITest.Assert.areSame,[h[e]],"Argument "+e+" of "+a+"() is incorrect.");}}if(f>0){g[a]=function(){try{c.actualCallCount++;YUITest.Assert.areEqual(h.length,arguments.length,"Method "+a+"() passed incorrect number of arguments.");for(var n=0,l=h.length;n<l;n++){h[n].verify(arguments[n]);}b=d.apply(this,arguments);if(j){throw j;}}catch(m){YUITest.TestRunner._handleError(m);}return c.hasOwnProperty("returns")?k:b;};}else{g[a]=function(){try{YUITest.Assert.fail("Method "+a+"() should not have been called.");}catch(i){YUITest.TestRunner._handleError(i);}};}}else{if(c.property){g.__expectations[c.property]=c;}}};YUITest.Mock.verify=function(a){try{for(var c in a.__expectations){if(a.__expectations.hasOwnProperty(c)){var b=a.__expectations[c];if(b.method){YUITest.Assert.areEqual(b.callCount,b.actualCallCount,"Method "+b.method+"() wasn't called the expected number of times.");}else{if(b.property){YUITest.Assert.areEqual(b.value,a[b.property],"Property "+b.property+" wasn't set to the correct value.");}}}}}catch(d){YUITest.TestRunner._handleError(d);}};YUITest.Mock.Value=function(c,a,b){if(this instanceof YUITest.Mock.Value){this.verify=function(e){var d=[].concat(a||[]);d.push(e);d.push(b);c.apply(null,d);};}else{return new YUITest.Mock.Value(c,a,b);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(a){this.name=a;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(a){this.passed+=a.passed;this.failed+=a.failed;this.ignored+=a.ignored;this.total+=a.total;this.errors+=a.errors;};YUITest.TestCase=function(a){this._should={};for(var b in a){this[b]=a[b];}if(typeof this.name!="string"){this.name=YUITest.guid("testCase_");}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);
},resume:function(a){YUITest.TestRunner.resume(a);},wait:function(c,a){var b=(typeof c=="number"?c:a);b=(typeof b=="number"?b:10000);if(typeof c=="function"){throw new YUITest.Wait(c,b);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},b);}},assert:function(b,a){YUITest.Assert._increment();if(!b){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Assertion failed."));}},fail:function(a){YUITest.Assert.fail(a);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(a){this.name="";this.items=[];if(typeof a=="string"){this.name=a;}else{if(a instanceof Object){for(var b in a){if(a.hasOwnProperty(b)){this[b]=a[b];}}}}if(this.name===""||!this.name){this.name=YUITest.guid("testSuite_");}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(a){if(a instanceof YUITest.TestSuite||a instanceof YUITest.TestCase){this.items.push(a);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function a(b){return b.replace(/[<>"'&]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";}});}return{JSON:function(b){return YUITest.Util.JSON.stringify(b);},XML:function(c){function b(e){var d="<"+e.type+' name="'+a(e.name)+'"';if(typeof(e.duration)=="number"){d+=' duration="'+e.duration+'"';}if(e.type=="test"){d+=' result="'+e.result+'" message="'+a(e.message)+'">';}else{d+=' passed="'+e.passed+'" failed="'+e.failed+'" ignored="'+e.ignored+'" total="'+e.total+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=b(e[f]);}}}}d+="</"+e.type+">";return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+b(c);},JUnitXML:function(b){function c(e){var d="";switch(e.type){case"test":if(e.result!="ignore"){d='<testcase name="'+a(e.name)+'" time="'+(e.duration/1000)+'">';if(e.result=="fail"){d+='<failure message="'+a(e.message)+'"><![CDATA['+e.message+"]]></failure>";}d+="</testcase>";}break;case"testcase":d='<testsuite name="'+a(e.name)+'" tests="'+e.total+'" failures="'+e.failed+'" time="'+(e.duration/1000)+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuite>";break;case"testsuite":for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}break;case"report":d="<testsuites>";for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuites>";}return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+c(b);},TAP:function(c){var d=1;function b(e){var f="";switch(e.type){case"test":if(e.result!="ignore"){f="ok "+(d++)+" - "+e.name;if(e.result=="fail"){f="not "+f+" - "+e.message;}f+="\n";}else{f="#Ignored test "+e.name+"\n";}break;case"testcase":f="#Begin testcase "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testcase "+e.name+"\n";break;case"testsuite":f="#Begin testsuite "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testsuite "+e.name+"\n";break;case"report":for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}}return f;}return"1.."+c.total+"\n"+b(c);}};}();YUITest.CoverageFormat={JSON:function(a){return YUITest.Util.JSON.stringify(a);},XdebugJSON:function(b){var a={};for(var c in b){if(b.hasOwnProperty(c)){a[c]=b[c].lines;}}return YUITest.Util.JSON.stringify(b);}};YUITest.TestRunner=function(){function c(e,g){if(!g.length){return true;}else{if(e){for(var f=0,d=e.length;f<d;f++){if(g.indexOf(","+e[f]+",")>-1){return true;}}}return false;}}function b(d){this.testObject=d;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results=new YUITest.Results();if(d instanceof YUITest.TestSuite){this.results.type="testsuite";this.results.name=d.name;}else{if(d instanceof YUITest.TestCase){this.results.type="testcase";this.results.name=d.name;}}}b.prototype={appendChild:function(d){var e=new b(d);if(this.firstChild===null){this.firstChild=this.lastChild=e;}else{this.lastChild.next=e;this.lastChild=e;}e.parent=this;return e;}};function a(){YUITest.EventTarget.call(this);this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));this._cur=null;this._root=null;this._log=true;this._waiting=false;this._running=false;this._lastResults=null;this._context=null;this._groups="";}a.prototype=YUITest.Util.mix(new YUITest.EventTarget(),{_ignoreEmpty:false,constructor:YUITest.TestRunner,TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",ERROR_EVENT:"error",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(e,f){var g=e.appendChild(f),h,d;for(h in f){if((h.indexOf("test")===0||h.indexOf(" ")>-1)&&typeof f[h]=="function"){g.appendChild(h);}}},_addTestSuiteToTestTree:function(d,g){var f=d.appendChild(g);for(var e=0;e<g.items.length;e++){if(g.items[e] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(f,g.items[e]);}else{if(g.items[e] instanceof YUITest.TestCase){this._addTestCaseToTestTree(f,g.items[e]);}}}},_buildTestTree:function(){this._root=new b(this.masterSuite);for(var d=0;d<this.masterSuite.items.length;d++){if(this.masterSuite.items[d] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[d]);}else{if(this.masterSuite.items[d] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[d]);}}}},_handleTestObjectComplete:function(e){var d;
-if(e&&(typeof e.testObject=="object")){d=e.parent;if(d){d.results.include(e.results);d.results[e.testObject.name]=e.results;}if(e.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(e,"tearDown",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:e.testObject,results:e.results});}else{if(e.testObject instanceof YUITest.TestCase){this._execNonTestMethod(e,"destroy",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:e.testObject,results:e.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{if(this._cur){this._cur=this._cur.next;}}}}}return this._cur;},_execNonTestMethod:function(h,d,i){var e=h.testObject,g={type:this.ERROR_EVENT};try{if(i&&e["async:"+d]){e["async:"+d](this._context);return true;}else{e[d](this._context);}}catch(f){h.results.errors++;g.error=f;g.methodName=d;if(e instanceof YUITest.TestCase){g.testCase=e;}else{g.testSuite=testSuite;}this.fire(g);}return false;},_run:function(){var f=false;var e=this._next();if(e!==null){this._running=true;this._lastResult=null;var d=e.testObject;if(typeof d=="object"&&d!==null){if(d instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:d});e._start=new Date();this._execNonTestMethod(e,"setUp",false);}else{if(d instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:d});e._start=new Date();if(this._execNonTestMethod(e,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(e);}}},_resumeTest:function(i){var d=this._cur;this._waiting=false;if(!d){return;}var j=d.testObject;var g=d.parent.testObject;if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}var m=j.indexOf("fail:")===0||(g._should.fail||{})[j];var e=(g._should.error||{})[j];var h=false;var k=null;try{i.call(g,this._context);if(YUITest.Assert._getCount()==0&&!this._ignoreEmpty){throw new YUITest.AssertionError("Test has no asserts.");}else{if(m){k=new YUITest.ShouldFail();h=true;}else{if(e){k=new YUITest.ShouldError();h=true;}}}}catch(l){if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}if(l instanceof YUITest.AssertionError){if(!m){k=l;h=true;}}else{if(l instanceof YUITest.Wait){if(typeof l.segment=="function"){if(typeof l.delay=="number"){if(typeof setTimeout!="undefined"){g.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(l.segment);},l.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!e){k=new YUITest.UnexpectedError(l);h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(d){if(!this._running&&typeof _yuitest_coverage=="object"){if(typeof d=="function"){return d(_yuitest_coverage);}else{return _yuitest_coverage;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];
+if(e&&(typeof e.testObject=="object")){d=e.parent;if(d){d.results.include(e.results);d.results[e.testObject.name]=e.results;}if(e.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(e,"tearDown",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:e.testObject,results:e.results});}else{if(e.testObject instanceof YUITest.TestCase){this._execNonTestMethod(e,"destroy",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:e.testObject,results:e.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{if(this._cur){this._cur=this._cur.next;}}}}}return this._cur;},_execNonTestMethod:function(h,d,i){var e=h.testObject,g={type:this.ERROR_EVENT};try{if(i&&e["async:"+d]){e["async:"+d](this._context);return true;}else{e[d](this._context);}}catch(f){h.results.errors++;g.error=f;g.methodName=d;if(e instanceof YUITest.TestCase){g.testCase=e;}else{g.testSuite=testSuite;}this.fire(g);}return false;},_run:function(){var f=false;var e=this._next();if(e!==null){this._running=true;this._lastResult=null;var d=e.testObject;if(typeof d=="object"&&d!==null){if(d instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:d});e._start=new Date();this._execNonTestMethod(e,"setUp",false);}else{if(d instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:d});e._start=new Date();if(this._execNonTestMethod(e,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(e);}}},_resumeTest:function(i){var d=this._cur;this._waiting=false;if(!d){return;}var j=d.testObject;var g=d.parent.testObject;if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}var m=j.indexOf("fail:")===0||(g._should.fail||{})[j];var e=(g._should.error||{})[j];var h=false;var k=null;try{i.call(g,this._context);if(YUITest.Assert._getCount()==0&&!this._ignoreEmpty){throw new YUITest.AssertionError("Test has no asserts.");}else{if(m){k=new YUITest.ShouldFail();h=true;}else{if(e){k=new YUITest.ShouldError();h=true;}}}}catch(l){if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}if(l instanceof YUITest.AssertionError){if(!m){k=l;h=true;}}else{if(l instanceof YUITest.Wait){if(typeof l.segment=="function"){if(typeof l.delay=="number"){if(typeof setTimeout!="undefined"){g.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(l.segment);},l.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!e){k=new YUITest.UnexpectedError(l);h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(e){var d=null;if(typeof _yuitest_coverage==="object"){d=_yuitest_coverage;}if(typeof __coverage__==="object"){d=__coverage__;}if(!this._running&&typeof d=="object"){if(typeof e=="function"){return e(d);}else{return d;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];
}f._groups=(e.groups instanceof Array)?","+e.groups.join(",")+",":"";f._buildTestTree();f._context={};f._root._start=new Date();f.fire(f.BEGIN_EVENT);f._run();}});return new a();}();
View
21 javascript/build/yuitest/yuitest-core.js
@@ -10,7 +10,7 @@
*/
var YUITest = {
- version: "0.7.8",
+ version: "0.7.9",
_idx: 0,
guid: function(pre) {
var id = (new Date()).getTime() + '_' + (++YUITest._idx);
@@ -1992,7 +1992,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -3448,12 +3448,19 @@ YUITest.CoverageFormat = {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
View
21 javascript/build/yuitest/yuitest-debug.js
@@ -10,7 +10,7 @@
*/
var YUITest = {
- version: "0.7.8",
+ version: "0.7.9",
_idx: 0,
guid: function(pre) {
var id = (new Date()).getTime() + '_' + (++YUITest._idx);
@@ -1992,7 +1992,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -4604,12 +4604,19 @@ YUITest.PageManager = YUITest.Util.mix(new YUITest.EventTarget(), {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
View
4 javascript/build/yuitest/yuitest-min.js
@@ -1,7 +1,7 @@
-var YUITest={version:"0.7.8",_idx:0,guid:function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;}};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();if(b!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be null."),null,b);
+var YUITest={version:"0.7.9",_idx:0,guid:function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;}};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();if(b!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be null."),null,b);
}},isUndefined:function(b,a){YUITest.Assert._increment();if(typeof b!="undefined"){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be undefined."),undefined,b);}},isArray:function(c,b){YUITest.Assert._increment();var a=false;if(Array.isArray){a=!Array.isArray(c);}else{a=Object.prototype.toString.call(c)!="[object Array]";}if(a){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Value should be an array."),c);}},isBoolean:function(b,a){YUITest.Assert._increment();if(typeof b!="boolean"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a Boolean."),b);}},isFunction:function(b,a){YUITest.Assert._increment();if(!(b instanceof Function)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a function."),b);}},isInstanceOf:function(b,c,a){YUITest.Assert._increment();if(!(c instanceof b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value isn't an instance of expected type."),b,c);}},isNumber:function(b,a){YUITest.Assert._increment();if(typeof b!="number"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a number."),b);}},isObject:function(b,a){YUITest.Assert._increment();if(!b||(typeof b!="object"&&typeof b!="function")){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be an object."),b);}},isString:function(b,a){YUITest.Assert._increment();if(typeof b!="string"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a string."),b);}},isTypeOf:function(a,c,b){YUITest.Assert._increment();if(typeof c!=a){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Value should be of type "+a+"."),a,typeof c);}},throwsError:function(d,e,c){YUITest.Assert._increment();var a=false;try{e();}catch(b){if(typeof d=="string"){if(b.message!=d){a=true;}}else{if(typeof d=="function"){if(!(b instanceof d)){a=true;}}else{if(typeof d=="object"&&d!==null){if(!(b instanceof d.constructor)||b.message!=d.message){a=true;}}else{a=true;}}}if(a){throw new YUITest.UnexpectedError(b);}else{return;}}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(c,"Error should have been thrown."));}};YUITest.ArrayAssert={_indexOf:function(b,c){if(b.indexOf){return b.indexOf(c);}else{for(var a=0;a<b.length;a++){if(b[a]===c){return a;}}return -1;}},_some:function(b,c){if(b.some){return b.some(c);}else{for(var a=0;a<b.length;a++){if(c(b[a])){return true;}}return false;}},contains:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value "+c+" ("+(typeof c)+") not found in array ["+b+"]."));}},containsItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value "+c[a]+" ("+(typeof c[a])+") not found in array ["+d+"]."));}}},containsMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"No match found in array ["+b+"]."));}},doesNotContain:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},doesNotContainItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value found in array ["+d+"]."));}}},doesNotContainMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},indexOf:function(e,d,a,c){YUITest.Assert._increment();for(var b=0;b<d.length;b++){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array ["+d+"]."));},itemsAreEqual:function(c,d,b){YUITest.Assert._increment();if(typeof c!="object"||typeof d!="object"){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value should be an array."));}if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length+"."));}for(var a=0;a<c.length;a++){if(c[a]!=d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not equal."),c[a],d[a]);}}},itemsAreEquivalent:function(d,e,a,c){YUITest.Assert._increment();if(typeof a!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(d.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Array should have a length of "+d.length+" but has a length of "+e.length));}for(var b=0;b<d.length;b++){if(!a(d[b],e[b])){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values in position "+b+" are not equivalent."),d[b],e[b]);}}},isEmpty:function(b,a){YUITest.Assert._increment();if(b.length>0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should be empty."));}},isNotEmpty:function(b,a){YUITest.Assert._increment();if(b.length===0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should not be empty."));}},itemsAreSame:function(c,d,b){YUITest.Assert._increment();if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length));}for(var a=0;a<c.length;a++){if(c[a]!==d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not the same."),c[a],d[a]);}}},lastIndexOf:function(e,d,a,c){for(var b=d.length;b>=0;b--){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));
}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array."));}};YUITest.ObjectAssert={areEqual:function(d,f,c){YUITest.Assert._increment();var b=YUITest.Object.keys(d),e=YUITest.Object.keys(f);if(b.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Object should have "+b.length+" keys but has "+e.length));}for(var a in d){if(d.hasOwnProperty(a)){if(d[a]!=f[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values should be equal for property "+a),d[a],f[a]);}}}},hasKey:function(a,b,c){YUITest.ObjectAssert.ownsOrInheritsKey(a,b,c);},hasKeys:function(b,a,c){YUITest.ObjectAssert.ownsOrInheritsKeys(b,a,c);},inheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b&&!b.hasOwnProperty(a))){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},inheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(propertyName in a&&!a.hasOwnProperty(c[b]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsKey:function(a,b,c){YUITest.Assert._increment();if(!b.hasOwnProperty(a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},ownsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!a.hasOwnProperty(c[b])){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsNoKeys:function(b,d){YUITest.Assert._increment();var c=0,a;for(a in b){if(b.hasOwnProperty(a)){c++;}}if(c!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Object owns "+c+" properties but should own none."));}},ownsOrInheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object."));}},ownsOrInheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(c[b] in a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getFullYear()!=d.getFullYear()){c="Years should be equal.";}if(b.getMonth()!=d.getMonth()){c="Months should be equal.";}if(b.getDate()!=d.getDate()){c="Days of month should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getHours()!=d.getHours()){c="Hours should be equal.";}if(b.getMinutes()!=d.getMinutes()){c="Minutes should be equal.";}if(b.getSeconds()!=d.getSeconds()){c="Seconds should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(d){d=d||{};var a,b;try{function e(){}e.prototype=d;a=new e();}catch(c){a={};}for(b in d){if(d.hasOwnProperty(b)){if(typeof d[b]=="function"){a[b]=function(f){return function(){YUITest.Assert.fail("Method "+f+"() was called but was not expected to be.");};}(b);}}}return a;};YUITest.Mock.expect=function(g,c){if(!g.__expectations){g.__expectations={};}if(c.method){var a=c.method,h=c.args||[],k=c.returns,f=(typeof c.callCount=="number")?c.callCount:1,j=c.error,d=c.run||function(){},b,e;g.__expectations[a]=c;c.callCount=f;c.actualCallCount=0;for(e=0;e<h.length;e++){if(!(h[e] instanceof YUITest.Mock.Value)){h[e]=YUITest.Mock.Value(YUITest.Assert.areSame,[h[e]],"Argument "+e+" of "+a+"() is incorrect.");}}if(f>0){g[a]=function(){try{c.actualCallCount++;YUITest.Assert.areEqual(h.length,arguments.length,"Method "+a+"() passed incorrect number of arguments.");for(var n=0,l=h.length;n<l;n++){h[n].verify(arguments[n]);}b=d.apply(this,arguments);if(j){throw j;}}catch(m){YUITest.TestRunner._handleError(m);}return c.hasOwnProperty("returns")?k:b;};}else{g[a]=function(){try{YUITest.Assert.fail("Method "+a+"() should not have been called.");}catch(i){YUITest.TestRunner._handleError(i);}};}}else{if(c.property){g.__expectations[c.property]=c;}}};YUITest.Mock.verify=function(a){try{for(var c in a.__expectations){if(a.__expectations.hasOwnProperty(c)){var b=a.__expectations[c];if(b.method){YUITest.Assert.areEqual(b.callCount,b.actualCallCount,"Method "+b.method+"() wasn't called the expected number of times.");}else{if(b.property){YUITest.Assert.areEqual(b.value,a[b.property],"Property "+b.property+" wasn't set to the correct value.");}}}}}catch(d){YUITest.TestRunner._handleError(d);}};YUITest.Mock.Value=function(c,a,b){if(this instanceof YUITest.Mock.Value){this.verify=function(e){var d=[].concat(a||[]);d.push(e);d.push(b);c.apply(null,d);};}else{return new YUITest.Mock.Value(c,a,b);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(a){this.name=a;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(a){this.passed+=a.passed;this.failed+=a.failed;this.ignored+=a.ignored;this.total+=a.total;this.errors+=a.errors;};YUITest.TestCase=function(a){this._should={};for(var b in a){this[b]=a[b];}if(typeof this.name!="string"){this.name=YUITest.guid("testCase_");}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);
},resume:function(a){YUITest.TestRunner.resume(a);},wait:function(c,a){var b=(typeof c=="number"?c:a);b=(typeof b=="number"?b:10000);if(typeof c=="function"){throw new YUITest.Wait(c,b);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},b);}},assert:function(b,a){YUITest.Assert._increment();if(!b){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Assertion failed."));}},fail:function(a){YUITest.Assert.fail(a);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(a){this.name="";this.items=[];if(typeof a=="string"){this.name=a;}else{if(a instanceof Object){for(var b in a){if(a.hasOwnProperty(b)){this[b]=a[b];}}}}if(this.name===""||!this.name){this.name=YUITest.guid("testSuite_");}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(a){if(a instanceof YUITest.TestSuite||a instanceof YUITest.TestCase){this.items.push(a);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function a(b){return b.replace(/[<>"'&]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";}});}return{JSON:function(b){return YUITest.Util.JSON.stringify(b);},XML:function(c){function b(e){var d="<"+e.type+' name="'+a(e.name)+'"';if(typeof(e.duration)=="number"){d+=' duration="'+e.duration+'"';}if(e.type=="test"){d+=' result="'+e.result+'" message="'+a(e.message)+'">';}else{d+=' passed="'+e.passed+'" failed="'+e.failed+'" ignored="'+e.ignored+'" total="'+e.total+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=b(e[f]);}}}}d+="</"+e.type+">";return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+b(c);},JUnitXML:function(b){function c(e){var d="";switch(e.type){case"test":if(e.result!="ignore"){d='<testcase name="'+a(e.name)+'" time="'+(e.duration/1000)+'">';if(e.result=="fail"){d+='<failure message="'+a(e.message)+'"><![CDATA['+e.message+"]]></failure>";}d+="</testcase>";}break;case"testcase":d='<testsuite name="'+a(e.name)+'" tests="'+e.total+'" failures="'+e.failed+'" time="'+(e.duration/1000)+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuite>";break;case"testsuite":for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}break;case"report":d="<testsuites>";for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuites>";}return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+c(b);},TAP:function(c){var d=1;function b(e){var f="";switch(e.type){case"test":if(e.result!="ignore"){f="ok "+(d++)+" - "+e.name;if(e.result=="fail"){f="not "+f+" - "+e.message;}f+="\n";}else{f="#Ignored test "+e.name+"\n";}break;case"testcase":f="#Begin testcase "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testcase "+e.name+"\n";break;case"testsuite":f="#Begin testsuite "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testsuite "+e.name+"\n";break;case"report":for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}}return f;}return"1.."+c.total+"\n"+b(c);}};}();YUITest.CoverageFormat={JSON:function(a){return YUITest.Util.JSON.stringify(a);},XdebugJSON:function(b){var a={};for(var c in b){if(b.hasOwnProperty(c)){a[c]=b[c].lines;}}return YUITest.Util.JSON.stringify(b);}};YUITest.Event=(function(){var i={click:1,dblclick:1,mouseover:1,mouseout:1,mousedown:1,mouseup:1,mousemove:1},h={keydown:1,keyup:1,keypress:1},c={blur:1,change:1,focus:1,resize:1,scroll:1,select:1},d={scroll:1,resize:1,reset:1,submit:1,change:1,select:1,error:1,abort:1,click:1,dblclick:1,mouseover:1,mouseout:1,mousedown:1,mouseup:1,mousemove:1,keydown:1,keyup:1,keypress:1},e,b;function g(o,s,n,l,u,k,j,t,q,w,v){if(!o){throw new Error("simulateKeyEvent(): Invalid target.");}if(typeof s=="string"){s=s.toLowerCase();switch(s){case"textevent":s="keypress";break;case"keyup":case"keydown":case"keypress":break;default:throw new Error("simulateKeyEvent(): Event type '"+s+"' not supported.");}}else{throw new Error("simulateKeyEvent(): Event type must be a string.");}if(typeof n!="boolean"){n=true;}if(typeof l!="boolean"){l=true;}if(typeof u!="object"||u==null){u=window;}if(typeof k!="boolean"){k=false;}if(typeof j!="boolean"){j=false;}if(typeof t!="boolean"){t=false;}if(typeof q!="boolean"){q=false;}if(typeof w!="number"){w=0;}if(typeof v!="number"){v=0;}var r=null;if(typeof document.createEvent=="function"){try{r=document.createEvent("KeyEvents");r.initKeyEvent(s,n,l,u,k,j,t,q,w,v);}catch(p){try{r=document.createEvent("Events");}catch(m){r=document.createEvent("UIEvents");}finally{r.initEvent(s,n,l);r.view=u;r.altKey=j;r.ctrlKey=k;r.shiftKey=t;r.metaKey=q;r.keyCode=w;r.charCode=v;}}o.dispatchEvent(r);}else{if(typeof document.createEventObject!="undefined"){r=document.createEventObject();r.bubbles=n;r.cancelable=l;r.view=u;r.ctrlKey=k;r.altKey=j;r.shiftKey=t;r.metaKey=q;r.keyCode=(v>0)?v:w;o.fireEvent("on"+s,r);}else{throw new Error("simulateKeyEvent(): No event simulation framework present.");}}}function a(t,y,q,n,z,s,p,o,m,k,l,j,x,v,r,u){if(!t){throw new Error("simulateMouseEvent(): Invalid target.");}if(typeof y=="string"){y=y.toLowerCase();if(!i[y]){throw new Error("simulateMouseEvent(): Event type '"+y+"' not supported.");}}else{throw new Error("simulateMouseEvent(): Event type must be a string.");}if(typeof q!="boolean"){q=true;}if(typeof n!="boolean"){n=(y!="mousemove");}if(typeof z!="object"||z!=null){z=window;}if(typeof s!="number"){s=1;}if(typeof p!="number"){p=0;
}if(typeof o!="number"){o=0;}if(typeof m!="number"){m=0;}if(typeof k!="number"){k=0;}if(typeof l!="boolean"){l=false;}if(typeof j!="boolean"){j=false;}if(typeof x!="boolean"){x=false;}if(typeof v!="boolean"){v=false;}if(typeof r!="number"){r=0;}if(!u){u=null;}var w=null;if(typeof document.createEvent=="function"){w=document.createEvent("MouseEvents");if(w.initMouseEvent){w.initMouseEvent(y,q,n,z,s,p,o,m,k,l,j,x,v,r,u);}else{w=document.createEvent("UIEvents");w.initEvent(y,q,n);w.view=z;w.detail=s;w.screenX=p;w.screenY=o;w.clientX=m;w.clientY=k;w.ctrlKey=l;w.altKey=j;w.metaKey=v;w.shiftKey=x;w.button=r;w.relatedTarget=u;}if(u&&!w.relatedTarget){if(y=="mouseout"){w.toElement=u;}else{if(y=="mouseover"){w.fromElement=u;}}}t.dispatchEvent(w);}else{if(typeof document.createEventObject!="undefined"){w=document.createEventObject();w.bubbles=q;w.cancelable=n;w.view=z;w.detail=s;w.screenX=p;w.screenY=o;w.clientX=m;w.clientY=k;w.ctrlKey=l;w.altKey=j;w.metaKey=v;w.shiftKey=x;switch(r){case 0:w.button=1;break;case 1:w.button=4;break;case 2:break;default:w.button=0;}w.relatedTarget=u;t.fireEvent("on"+y,w);}else{throw new Error("simulateMouseEvent(): No event simulation framework present.");}}}function f(p,o,l,k,j,n){if(!p){throw new Error("simulateUIEvent(): Invalid target.");}if(typeof o=="string"){o=o.toLowerCase();if(!c[o]){throw new Error("simulateUIEvent(): Event type '"+o+"' not supported.");}}else{throw new Error("simulateUIEvent(): Event type must be a string.");}var m=null;if(typeof l!="boolean"){l=(o in d);}if(typeof k!="boolean"){k=(o=="submit");}if(typeof j!="object"||j!=null){j=window;}if(typeof n!="number"){n=1;}if(typeof document.createEvent=="function"){m=document.createEvent("UIEvents");m.initUIEvent(o,l,k,j,n);p.dispatchEvent(m);}else{if(typeof document.createEventObject!="undefined"){m=document.createEventObject();m.bubbles=l;m.cancelable=k;m.view=j;m.detail=n;p.fireEvent("on"+o,m);}else{throw new Error("simulateUIEvent(): No event simulation framework present.");}}}e={simulate:function(l,k,j){j=j||{};if(i[k]){a(l,k,j.bubbles,j.cancelable,j.view,j.detail,j.screenX,j.screenY,j.clientX,j.clientY,j.ctrlKey,j.altKey,j.shiftKey,j.metaKey,j.button,j.relatedTarget);}else{if(h[k]){g(l,k,j.bubbles,j.cancelable,j.view,j.ctrlKey,j.altKey,j.shiftKey,j.metaKey,j.keyCode,j.charCode);}else{if(c[k]){f(l,k,j.bubbles,j.cancelable,j.view,j.detail);}else{throw new Error("simulate(): Event '"+k+"' can't be simulated.");}}}}};for(b in i){if(i.hasOwnProperty(b)){e[b]=(function(j){return function(l,k){k=k||{};a(l,j,k.bubbles,k.cancelable,k.view,k.detail,k.screenX,k.screenY,k.clientX,k.clientY,k.ctrlKey,k.altKey,k.shiftKey,k.metaKey,k.button,k.relatedTarget);};})(b);}}for(b in h){if(h.hasOwnProperty(b)){e[b]=(function(j){return function(l,k){k=k||{};g(l,j,k.bubbles,k.cancelable,k.view,k.ctrlKey,k.altKey,k.shiftKey,k.metaKey,k.keyCode,k.charCode);};})(b);}}for(b in c){if(c.hasOwnProperty(b)){e[b]=(function(j){return function(l,k){k=k||{};f(l,j,k.bubbles,k.cancelable,k.view,k.detail);};})(b);}}return e;})();YUITest.Reporter=function(a,b){this.url=a;this.format=b||YUITest.TestFormat.XML;this._fields=new Object();this._form=null;this._iframe=null;};YUITest.Reporter.prototype={constructor:YUITest.Reporter,addField:function(a,b){this._fields[a]=b;},clearFields:function(){this._fields=new Object();},destroy:function(){if(this._form){this._form.parentNode.removeChild(this._form);this._form=null;}if(this._iframe){this._iframe.parentNode.removeChild(this._iframe);this._iframe=null;}this._fields=null;},report:function(c){if(!this._form){this._form=document.createElement("form");this._form.method="post";this._form.style.visibility="hidden";this._form.style.position="absolute";this._form.style.top=0;document.body.appendChild(this._form);try{this._iframe=document.createElement('<iframe name="yuiTestTarget" />');}catch(b){this._iframe=document.createElement("iframe");this._iframe.name="yuiTestTarget";}this._iframe.src="javascript:false";this._iframe.style.visibility="hidden";this._iframe.style.position="absolute";this._iframe.style.top=0;document.body.appendChild(this._iframe);this._form.target="yuiTestTarget";}this._form.action=this.url;while(this._form.hasChildNodes()){this._form.removeChild(this._form.lastChild);}this._fields.results=this.format(c);this._fields.useragent=navigator.userAgent;this._fields.timestamp=(new Date()).toLocaleString();for(var e in this._fields){var d=this._fields[e];if(this._fields.hasOwnProperty(e)&&(typeof d!="function")){var a=document.createElement("input");a.type="hidden";a.name=e;a.value=d;this._form.appendChild(a);}}delete this._fields.results;delete this._fields.useragent;delete this._fields.timestamp;if(arguments[1]!==false){this._form.submit();}}};YUITest.PageManager=YUITest.Util.mix(new YUITest.EventTarget(),{TEST_PAGE_BEGIN_EVENT:"testpagebegin",TEST_PAGE_COMPLETE_EVENT:"testpagecomplete",TEST_MANAGER_BEGIN_EVENT:"testmanagerbegin",TEST_MANAGER_COMPLETE_EVENT:"testmanagercomplete",_curPage:null,_frame:null,_timeoutId:0,_pages:[],_results:null,_handleTestRunnerComplete:function(a){this.fire(this.TEST_PAGE_COMPLETE_EVENT,{page:this._curPage,results:a.results});this._processResults(this._curPage,a.results);if(this._pages.length){this._timeoutId=setTimeout(function(){YUITest.TestManager._run();},1000);}else{this.fire(this.TEST_MANAGER_COMPLETE_EVENT,this._results);}},_processResults:function(c,a){var b=this._results;b.passed+=a.passed;b.failed+=a.failed;b.ignored+=a.ignored;b.total+=a.total;b.duration+=a.duration;if(a.failed){b.failedPages.push(c);}else{b.passedPages.push(c);}a.name=c;a.type="page";b[c]=a;},_run:function(){this._curPage=this._pages.shift();this.fire(this.TEST_PAGE_BEGIN_EVENT,this._curPage);this._frame.location.replace(this._curPage);},load:function(){if(parent.YUITest.PageManager!==this){parent.YUITest.PageManager.load();}else{if(this._frame){var a=this._frame.YUITest.TestRunner;a.subscribe(a.COMPLETE_EVENT,this._handleTestRunnerComplete,this,true);a.run();}}},setPages:function(a){this._pages=a;
},start:function(){if(!this._initialized){if(!this._frame){var a=document.createElement("iframe");a.style.visibility="hidden";a.style.position="absolute";document.body.appendChild(a);this._frame=a.contentWindow||a.contentDocument.parentWindow;}this._initialized=true;}this._results={passed:0,failed:0,ignored:0,total:0,type:"report",name:"YUI Test Results",duration:0,failedPages:[],passedPages:[]};this.fire(this.TEST_MANAGER_BEGIN_EVENT,null);this._run();},stop:function(){clearTimeout(this._timeoutId);}});YUITest.TestRunner=function(){function c(e,g){if(!g.length){return true;}else{if(e){for(var f=0,d=e.length;f<d;f++){if(g.indexOf(","+e[f]+",")>-1){return true;}}}return false;}}function b(d){this.testObject=d;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results=new YUITest.Results();if(d instanceof YUITest.TestSuite){this.results.type="testsuite";this.results.name=d.name;}else{if(d instanceof YUITest.TestCase){this.results.type="testcase";this.results.name=d.name;}}}b.prototype={appendChild:function(d){var e=new b(d);if(this.firstChild===null){this.firstChild=this.lastChild=e;}else{this.lastChild.next=e;this.lastChild=e;}e.parent=this;return e;}};function a(){YUITest.EventTarget.call(this);this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));this._cur=null;this._root=null;this._log=true;this._waiting=false;this._running=false;this._lastResults=null;this._context=null;this._groups="";}a.prototype=YUITest.Util.mix(new YUITest.EventTarget(),{_ignoreEmpty:false,constructor:YUITest.TestRunner,TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",ERROR_EVENT:"error",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(e,f){var g=e.appendChild(f),h,d;for(h in f){if((h.indexOf("test")===0||h.indexOf(" ")>-1)&&typeof f[h]=="function"){g.appendChild(h);}}},_addTestSuiteToTestTree:function(d,g){var f=d.appendChild(g);for(var e=0;e<g.items.length;e++){if(g.items[e] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(f,g.items[e]);}else{if(g.items[e] instanceof YUITest.TestCase){this._addTestCaseToTestTree(f,g.items[e]);}}}},_buildTestTree:function(){this._root=new b(this.masterSuite);for(var d=0;d<this.masterSuite.items.length;d++){if(this.masterSuite.items[d] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[d]);}else{if(this.masterSuite.items[d] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[d]);}}}},_handleTestObjectComplete:function(e){var d;if(e&&(typeof e.testObject=="object")){d=e.parent;if(d){d.results.include(e.results);d.results[e.testObject.name]=e.results;}if(e.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(e,"tearDown",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:e.testObject,results:e.results});}else{if(e.testObject instanceof YUITest.TestCase){this._execNonTestMethod(e,"destroy",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:e.testObject,results:e.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{if(this._cur){this._cur=this._cur.next;}}}}}return this._cur;},_execNonTestMethod:function(h,d,i){var e=h.testObject,g={type:this.ERROR_EVENT};try{if(i&&e["async:"+d]){e["async:"+d](this._context);return true;}else{e[d](this._context);}}catch(f){h.results.errors++;g.error=f;g.methodName=d;if(e instanceof YUITest.TestCase){g.testCase=e;}else{g.testSuite=testSuite;}this.fire(g);}return false;},_run:function(){var f=false;var e=this._next();if(e!==null){this._running=true;this._lastResult=null;var d=e.testObject;if(typeof d=="object"&&d!==null){if(d instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:d});e._start=new Date();this._execNonTestMethod(e,"setUp",false);}else{if(d instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:d});e._start=new Date();if(this._execNonTestMethod(e,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(e);}}},_resumeTest:function(i){var d=this._cur;this._waiting=false;if(!d){return;}var j=d.testObject;var g=d.parent.testObject;if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}var m=j.indexOf("fail:")===0||(g._should.fail||{})[j];var e=(g._should.error||{})[j];var h=false;var k=null;try{i.call(g,this._context);if(YUITest.Assert._getCount()==0&&!this._ignoreEmpty){throw new YUITest.AssertionError("Test has no asserts.");}else{if(m){k=new YUITest.ShouldFail();h=true;}else{if(e){k=new YUITest.ShouldError();h=true;}}}}catch(l){if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}if(l instanceof YUITest.AssertionError){if(!m){k=l;h=true;}}else{if(l instanceof YUITest.Wait){if(typeof l.segment=="function"){if(typeof l.delay=="number"){if(typeof setTimeout!="undefined"){g.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(l.segment);},l.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!e){k=new YUITest.UnexpectedError(l);
-h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(d){if(!this._running&&typeof _yuitest_coverage=="object"){if(typeof d=="function"){return d(_yuitest_coverage);}else{return _yuitest_coverage;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];}f._groups=(e.groups instanceof Array)?","+e.groups.join(",")+",":"";f._buildTestTree();f._context={};f._root._start=new Date();f.fire(f.BEGIN_EVENT);f._run();}});return new a();}();
+h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(e){var d=null;if(typeof _yuitest_coverage==="object"){d=_yuitest_coverage;}if(typeof __coverage__==="object"){d=__coverage__;}if(!this._running&&typeof d=="object"){if(typeof e=="function"){return e(d);}else{return d;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];}f._groups=(e.groups instanceof Array)?","+e.groups.join(",")+",":"";f._buildTestTree();f._context={};f._root._start=new Date();f.fire(f.BEGIN_EVENT);f._run();}});return new a();}();
View
14 javascript/build/yuitest/yuitest-node-cli-debug.js
@@ -42,16 +42,7 @@ YUITest.CLI = {
},
quit: function(code){
-
- //Workaround for https://github.com/joyent/node/issues/1669
- var flushed = process.stdout.flush && process.stdout.flush();
- if (!flushed && (parseFloat(process.versions.node) < 0.5)) {
- process.once("drain", function () {
- process.exit(code || 0);
- });
- } else {
- process.exit(code || 0);
- }
+ process.exit(code || 0);
},
isDirectory: function(name) {
@@ -512,6 +503,9 @@ YUITest.Util.mix(YUITest.CLI, {
this.processArguments();
this.processFiles();
+ YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT, function(event) {
+ YUITest.CLI.quit(event.results.failed ? 1 : 0);
+ });
YUITest.TestRunner.run({
groups: this.options.groups ? this.options.groups.split(",") : null
View
4 javascript/build/yuitest/yuitest-node-cli-min.js
@@ -1,2 +1,2 @@
-var fs=require("fs"),path=require("path"),exists=fs.existsSync||path.existsSync,vm=null,YUITest=require("yuitest"),stdout=process.stdout,stderr=process.stderr||stdout;if(process.binding("natives").vm){vm=require("vm");}process.on("exit",function(){var a=YUITest.TestRunner.getResults();if(a&&a.failed){YUITest.CLI.quit(1);}});YUITest.CLI={args:process.argv.slice(2),print:function(a){fs.writeSync(1,a);},println:function(a){this.print(a+"\n");},warn:function(a){console.warn(a);},quit:function(b){var a=process.stdout.flush&&process.stdout.flush();if(!a&&(parseFloat(process.versions.node)<0.5)){process.once("drain",function(){process.exit(b||0);});}else{process.exit(b||0);}},isDirectory:function(a){if(exists(a)){var b=fs.statSync(a);return b.isDirectory();}else{this.warn("File Not Found: "+a);this.quit(1);}},getFiles:function(a){var c=[];try{fs.statSync(a);}catch(b){return[];}function d(f,e){e.push(f);fs.readdirSync(e.join("/")).forEach(function(g){var i=e.concat([g]).join("/"),h=fs.statSync(i);if(g[0]=="."){return;}else{if(h.isFile()&&/\.js$/.test(g)){c.push(i);}else{if(h.isDirectory()){d(g,e);}}}});e.pop();}d(a,[]);return c;},getFullPath:function(a){return path.resolve(process.cwd(),a);},readFile:function(a){return fs.readFileSync(a,"utf-8");},processFiles:function(){var f=this.files,e,g,d,a,b;if(f.length){for(d=0,a=f.length;d<a;d++){if(this.options.verbose){this.warn("[INFO] Loading "+f[d]+"\n");}if(this.options.webcompat){b=fs.readFileSync(f[d]);if(vm){vm.runInThisContext("(function(YUITest){\n"+b+"\n})",f[d])(YUITest);}else{process.compile("(function(YUITest){\n"+b+"\n})",f[d])(YUITest);}}else{try{require(path.resolve(process.cwd(),f[d]));}catch(c){this.warn("[ERROR] "+c.stack);this.warn("\n[ERROR] No tests loaded from "+f[d]+". If you're not using CommonJS module format, try running with --webcompat option.\n");this.quit(1);}}}}else{this.warn("[ERROR] No tests to run, exiting.\n");this.quit(1);}}};YUITest.CLI.Logger=function(){var c=YUITest.TestRunner,a=YUITest.CLI;function b(e){var d="";switch(e.type){case c.BEGIN_EVENT:d="Testing began at "+(new Date()).toString()+".";messageType="info";break;case c.COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;case c.TEST_FAIL_EVENT:d=e.testName+": failed.\n"+e.error.getMessage();messageType="fail";break;case c.ERROR_EVENT:d=e.methodName+": error.\n"+e.error.message;messageType="error";break;case c.TEST_IGNORE_EVENT:d=e.testName+": ignored.";messageType="ignore";break;case c.TEST_PASS_EVENT:d=e.testName+": passed.";messageType="pass";break;case c.TEST_SUITE_BEGIN_EVENT:d='Test suite "'+e.testSuite.name+'" started.';messageType="info";break;case c.TEST_SUITE_COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;case c.TEST_CASE_BEGIN_EVENT:d='Test case "'+e.testCase.name+'" started.';messageType="info";break;case c.TEST_CASE_COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;default:d="Unexpected event "+e.type;messageType="info";}a.print(d+"\n");}c.subscribe(c.BEGIN_EVENT,b);c.subscribe(c.TEST_FAIL_EVENT,b);c.subscribe(c.TEST_PASS_EVENT,b);c.subscribe(c.TEST_IGNORE_EVENT,b);c.subscribe(c.TEST_CASE_BEGIN_EVENT,b);c.subscribe(c.TEST_CASE_COMPLETE_EVENT,b);c.subscribe(c.TEST_SUITE_BEGIN_EVENT,b);c.subscribe(c.TEST_SUITE_COMPLETE_EVENT,b);c.subscribe(c.COMPLETE_EVENT,b);};YUITest.CLI.XUnit=function(){var f=YUITest.TestRunner,b=YUITest.CLI,g=[],e=[],a=[];function d(k){if(k){var l=k.split("\n"),j=[],m,h;for(m=1,h=l.length;m<h;m++){if(l[m].indexOf("yuitest-node")>-1){break;}else{j.push(l[m]);}}return j.join("\n");}else{return"Unavailable.";}}function c(m){var l="",k=m.results,j,h;switch(m.type){case f.BEGIN_EVENT:l="YUITest@"+YUITest.version+"\n";if(f._groups){l+="Filtering on groups '"+f._groups.slice(1,-1)+"'\n";}break;case f.COMPLETE_EVENT:l="\nTotal tests: "+k.total+", Failures: "+k.failed+", Skipped: "+k.ignored+", Time: "+(k.duration/1000)+" seconds\n";if(e.length){l+="\nTests failed:\n";for(j=0,h=e.length;j<h;j++){l+="\n"+(j+1)+") "+e[j].name+" : "+e[j].error.getMessage()+"\n";if(e[j].error.stack){l+="Stack trace:\n"+d(e[j].error.stack)+"\n";}}l+="\n";}if(g.length){l+="\nErrors:\n";for(j=0,h=g.length;j<h;j++){l+="\n"+(j+1)+") "+g[j].name+" : "+g[j].error.message+"\n";if(g[j].error.stack){l+="Stack trace:\n"+d(g[j].error.stack)+"\n";}}l+="\n";}l+="\n\n";break;case f.TEST_FAIL_EVENT:l="F";e.push({name:a.concat([m.testName]).join(" > "),error:m.error});break;case f.ERROR_EVENT:g.push({name:a.concat([m.methodName]).join(" > "),error:m.error});break;case f.TEST_IGNORE_EVENT:l="S";break;case f.TEST_PASS_EVENT:l=".";break;case f.TEST_SUITE_BEGIN_EVENT:a.push(m.testSuite.name);break;case f.TEST_CASE_COMPLETE_EVENT:case f.TEST_SUITE_COMPLETE_EVENT:a.pop();break;case f.TEST_CASE_BEGIN_EVENT:a.push(m.testCase.name);break;}b.print(l);}f.subscribe(f.BEGIN_EVENT,c);f.subscribe(f.TEST_FAIL_EVENT,c);f.subscribe(f.TEST_PASS_EVENT,c);f.subscribe(f.ERROR_EVENT,c);f.subscribe(f.TEST_IGNORE_EVENT,c);f.subscribe(f.TEST_CASE_BEGIN_EVENT,c);f.subscribe(f.TEST_CASE_COMPLETE_EVENT,c);f.subscribe(f.TEST_SUITE_BEGIN_EVENT,c);f.subscribe(f.TEST_SUITE_COMPLETE_EVENT,c);f.subscribe(f.COMPLETE_EVENT,c);};YUITest.CLI.Format=function(d){var c=YUITest.TestRunner,a=YUITest.CLI;function b(f){var e=f.results;a.print(d(e));}c.subscribe(c.COMPLETE_EVENT,b);};YUITest.Util.mix(YUITest.CLI,{files:[],options:{verbose:false,webcompat:false,help:false,version:false,format:"xunit"},outputVersion:function(){this.print(YUITest.version+"\n");},outputHelp:function(){this.print(["\nUsage: yuitest [options] [file|dir]*"," ","Global Options"," --groups groupname Run only tests cases that are part of groupname."," --help, -h Displays this information."," --version, -v Displays the current version."," --format <format> Specifies output format (junitxml, tap, xunit)."," --verbose Display informational messages and warnings."," --webcompat Load tests designed for use in browsers."].join("\n")+"\n\n");
-},processArguments:function(){var b=this.args,a=b.shift(),c=[];while(a){if(a.indexOf("--")==0){this.options[a.substring(2)]=true;if(a=="--groups"||a=="--format"){this.options[a.substring(2)]=b.shift();}}else{switch(a){case"-h":this.options.help=true;break;case"-v":this.options.version=true;break;default:if(this.isDirectory(a)){c=c.concat(this.getFiles(a));}else{c.push(a);}}}a=b.shift();}if(this.options.version){this.outputVersion();this.quit(0);}if(this.options.help||c.length===0){this.outputHelp();this.quit(0);}this.files=c;switch(this.options.format){case"junitxml":if(this.options.verbose){this.warn("[INFO] Using JUnitXML output format.\n");}YUITest.CLI.Format(YUITest.TestFormat.JUnitXML);break;case"tap":if(this.options.verbose){this.warn("[INFO] Using TAP output format.\n");}YUITest.CLI.Format(YUITest.TestFormat.TAP);break;default:if(this.options.verbose){this.warn("[INFO] Using XUnit output format.\n");}YUITest.CLI.XUnit();}},start:function(){this.processArguments();this.processFiles();YUITest.TestRunner.run({groups:this.options.groups?this.options.groups.split(","):null});}});YUITest.CLI.start();
+var fs=require("fs"),path=require("path"),exists=fs.existsSync||path.existsSync,vm=null,YUITest=require("yuitest"),stdout=process.stdout,stderr=process.stderr||stdout;if(process.binding("natives").vm){vm=require("vm");}process.on("exit",function(){var a=YUITest.TestRunner.getResults();if(a&&a.failed){YUITest.CLI.quit(1);}});YUITest.CLI={args:process.argv.slice(2),print:function(a){fs.writeSync(1,a);},println:function(a){this.print(a+"\n");},warn:function(a){console.warn(a);},quit:function(a){process.exit(a||0);},isDirectory:function(a){if(exists(a)){var b=fs.statSync(a);return b.isDirectory();}else{this.warn("File Not Found: "+a);this.quit(1);}},getFiles:function(a){var c=[];try{fs.statSync(a);}catch(b){return[];}function d(f,e){e.push(f);fs.readdirSync(e.join("/")).forEach(function(g){var i=e.concat([g]).join("/"),h=fs.statSync(i);if(g[0]=="."){return;}else{if(h.isFile()&&/\.js$/.test(g)){c.push(i);}else{if(h.isDirectory()){d(g,e);}}}});e.pop();}d(a,[]);return c;},getFullPath:function(a){return path.resolve(process.cwd(),a);},readFile:function(a){return fs.readFileSync(a,"utf-8");},processFiles:function(){var f=this.files,e,g,d,a,b;if(f.length){for(d=0,a=f.length;d<a;d++){if(this.options.verbose){this.warn("[INFO] Loading "+f[d]+"\n");}if(this.options.webcompat){b=fs.readFileSync(f[d]);if(vm){vm.runInThisContext("(function(YUITest){\n"+b+"\n})",f[d])(YUITest);}else{process.compile("(function(YUITest){\n"+b+"\n})",f[d])(YUITest);}}else{try{require(path.resolve(process.cwd(),f[d]));}catch(c){this.warn("[ERROR] "+c.stack);this.warn("\n[ERROR] No tests loaded from "+f[d]+". If you're not using CommonJS module format, try running with --webcompat option.\n");this.quit(1);}}}}else{this.warn("[ERROR] No tests to run, exiting.\n");this.quit(1);}}};YUITest.CLI.Logger=function(){var c=YUITest.TestRunner,a=YUITest.CLI;function b(e){var d="";switch(e.type){case c.BEGIN_EVENT:d="Testing began at "+(new Date()).toString()+".";messageType="info";break;case c.COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;case c.TEST_FAIL_EVENT:d=e.testName+": failed.\n"+e.error.getMessage();messageType="fail";break;case c.ERROR_EVENT:d=e.methodName+": error.\n"+e.error.message;messageType="error";break;case c.TEST_IGNORE_EVENT:d=e.testName+": ignored.";messageType="ignore";break;case c.TEST_PASS_EVENT:d=e.testName+": passed.";messageType="pass";break;case c.TEST_SUITE_BEGIN_EVENT:d='Test suite "'+e.testSuite.name+'" started.';messageType="info";break;case c.TEST_SUITE_COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;case c.TEST_CASE_BEGIN_EVENT:d='Test case "'+e.testCase.name+'" started.';messageType="info";break;case c.TEST_CASE_COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;default:d="Unexpected event "+e.type;messageType="info";}a.print(d+"\n");}c.subscribe(c.BEGIN_EVENT,b);c.subscribe(c.TEST_FAIL_EVENT,b);c.subscribe(c.TEST_PASS_EVENT,b);c.subscribe(c.TEST_IGNORE_EVENT,b);c.subscribe(c.TEST_CASE_BEGIN_EVENT,b);c.subscribe(c.TEST_CASE_COMPLETE_EVENT,b);c.subscribe(c.TEST_SUITE_BEGIN_EVENT,b);c.subscribe(c.TEST_SUITE_COMPLETE_EVENT,b);c.subscribe(c.COMPLETE_EVENT,b);};YUITest.CLI.XUnit=function(){var f=YUITest.TestRunner,b=YUITest.CLI,g=[],e=[],a=[];function d(k){if(k){var l=k.split("\n"),j=[],m,h;for(m=1,h=l.length;m<h;m++){if(l[m].indexOf("yuitest-node")>-1){break;}else{j.push(l[m]);}}return j.join("\n");}else{return"Unavailable.";}}function c(m){var l="",k=m.results,j,h;switch(m.type){case f.BEGIN_EVENT:l="YUITest@"+YUITest.version+"\n";if(f._groups){l+="Filtering on groups '"+f._groups.slice(1,-1)+"'\n";}break;case f.COMPLETE_EVENT:l="\nTotal tests: "+k.total+", Failures: "+k.failed+", Skipped: "+k.ignored+", Time: "+(k.duration/1000)+" seconds\n";if(e.length){l+="\nTests failed:\n";for(j=0,h=e.length;j<h;j++){l+="\n"+(j+1)+") "+e[j].name+" : "+e[j].error.getMessage()+"\n";if(e[j].error.stack){l+="Stack trace:\n"+d(e[j].error.stack)+"\n";}}l+="\n";}if(g.length){l+="\nErrors:\n";for(j=0,h=g.length;j<h;j++){l+="\n"+(j+1)+") "+g[j].name+" : "+g[j].error.message+"\n";if(g[j].error.stack){l+="Stack trace:\n"+d(g[j].error.stack)+"\n";}}l+="\n";}l+="\n\n";break;case f.TEST_FAIL_EVENT:l="F";e.push({name:a.concat([m.testName]).join(" > "),error:m.error});break;case f.ERROR_EVENT:g.push({name:a.concat([m.methodName]).join(" > "),error:m.error});break;case f.TEST_IGNORE_EVENT:l="S";break;case f.TEST_PASS_EVENT:l=".";break;case f.TEST_SUITE_BEGIN_EVENT:a.push(m.testSuite.name);break;case f.TEST_CASE_COMPLETE_EVENT:case f.TEST_SUITE_COMPLETE_EVENT:a.pop();break;case f.TEST_CASE_BEGIN_EVENT:a.push(m.testCase.name);break;}b.print(l);}f.subscribe(f.BEGIN_EVENT,c);f.subscribe(f.TEST_FAIL_EVENT,c);f.subscribe(f.TEST_PASS_EVENT,c);f.subscribe(f.ERROR_EVENT,c);f.subscribe(f.TEST_IGNORE_EVENT,c);f.subscribe(f.TEST_CASE_BEGIN_EVENT,c);f.subscribe(f.TEST_CASE_COMPLETE_EVENT,c);f.subscribe(f.TEST_SUITE_BEGIN_EVENT,c);f.subscribe(f.TEST_SUITE_COMPLETE_EVENT,c);f.subscribe(f.COMPLETE_EVENT,c);};YUITest.CLI.Format=function(d){var c=YUITest.TestRunner,a=YUITest.CLI;function b(f){var e=f.results;a.print(d(e));}c.subscribe(c.COMPLETE_EVENT,b);};YUITest.Util.mix(YUITest.CLI,{files:[],options:{verbose:false,webcompat:false,help:false,version:false,format:"xunit"},outputVersion:function(){this.print(YUITest.version+"\n");},outputHelp:function(){this.print(["\nUsage: yuitest [options] [file|dir]*"," ","Global Options"," --groups groupname Run only tests cases that are part of groupname."," --help, -h Displays this information."," --version, -v Displays the current version."," --format <format> Specifies output format (junitxml, tap, xunit)."," --verbose Display informational messages and warnings."," --webcompat Load tests designed for use in browsers."].join("\n")+"\n\n");
+},processArguments:function(){var b=this.args,a=b.shift(),c=[];while(a){if(a.indexOf("--")==0){this.options[a.substring(2)]=true;if(a=="--groups"||a=="--format"){this.options[a.substring(2)]=b.shift();}}else{switch(a){case"-h":this.options.help=true;break;case"-v":this.options.version=true;break;default:if(this.isDirectory(a)){c=c.concat(this.getFiles(a));}else{c.push(a);}}}a=b.shift();}if(this.options.version){this.outputVersion();this.quit(0);}if(this.options.help||c.length===0){this.outputHelp();this.quit(0);}this.files=c;switch(this.options.format){case"junitxml":if(this.options.verbose){this.warn("[INFO] Using JUnitXML output format.\n");}YUITest.CLI.Format(YUITest.TestFormat.JUnitXML);break;case"tap":if(this.options.verbose){this.warn("[INFO] Using TAP output format.\n");}YUITest.CLI.Format(YUITest.TestFormat.TAP);break;default:if(this.options.verbose){this.warn("[INFO] Using XUnit output format.\n");}YUITest.CLI.XUnit();}},start:function(){this.processArguments();this.processFiles();YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT,function(a){YUITest.CLI.quit(a.results.failed?1:0);});YUITest.TestRunner.run({groups:this.options.groups?this.options.groups.split(","):null});}});YUITest.CLI.start();
View
14 javascript/build/yuitest/yuitest-node-cli.js
@@ -42,16 +42,7 @@ YUITest.CLI = {
},
quit: function(code){
-
- //Workaround for https://github.com/joyent/node/issues/1669
- var flushed = process.stdout.flush && process.stdout.flush();
- if (!flushed && (parseFloat(process.versions.node) < 0.5)) {
- process.once("drain", function () {
- process.exit(code || 0);
- });
- } else {
- process.exit(code || 0);
- }
+ process.exit(code || 0);
},
isDirectory: function(name) {
@@ -512,6 +503,9 @@ YUITest.Util.mix(YUITest.CLI, {
this.processArguments();
this.processFiles();
+ YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT, function(event) {
+ YUITest.CLI.quit(event.results.failed ? 1 : 0);
+ });
YUITest.TestRunner.run({
groups: this.options.groups ? this.options.groups.split(",") : null
View
21 javascript/build/yuitest/yuitest-node-debug.js
@@ -10,7 +10,7 @@
*/
var YUITest = exports;
-YUITest.version = "0.7.8";
+YUITest.version = "0.7.9";
//backwards compatibility
exports.YUITest = YUITest;
@@ -1995,7 +1995,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -3451,12 +3451,19 @@ YUITest.CoverageFormat = {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
View
6 javascript/build/yuitest/yuitest-node-min.js
@@ -1,6 +1,6 @@
-var YUITest=exports;YUITest.version="0.7.8";exports.YUITest=YUITest;YUITest._idx=0;YUITest.guid=function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();
+var YUITest=exports;YUITest.version="0.7.9";exports.YUITest=YUITest;YUITest._idx=0;YUITest.guid=function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();
if(b!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be null."),null,b);}},isUndefined:function(b,a){YUITest.Assert._increment();if(typeof b!="undefined"){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be undefined."),undefined,b);}},isArray:function(c,b){YUITest.Assert._increment();var a=false;if(Array.isArray){a=!Array.isArray(c);}else{a=Object.prototype.toString.call(c)!="[object Array]";}if(a){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Value should be an array."),c);}},isBoolean:function(b,a){YUITest.Assert._increment();if(typeof b!="boolean"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a Boolean."),b);}},isFunction:function(b,a){YUITest.Assert._increment();if(!(b instanceof Function)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a function."),b);}},isInstanceOf:function(b,c,a){YUITest.Assert._increment();if(!(c instanceof b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value isn't an instance of expected type."),b,c);}},isNumber:function(b,a){YUITest.Assert._increment();if(typeof b!="number"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a number."),b);}},isObject:function(b,a){YUITest.Assert._increment();if(!b||(typeof b!="object"&&typeof b!="function")){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be an object."),b);}},isString:function(b,a){YUITest.Assert._increment();if(typeof b!="string"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a string."),b);}},isTypeOf:function(a,c,b){YUITest.Assert._increment();if(typeof c!=a){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Value should be of type "+a+"."),a,typeof c);}},throwsError:function(d,e,c){YUITest.Assert._increment();var a=false;try{e();}catch(b){if(typeof d=="string"){if(b.message!=d){a=true;}}else{if(typeof d=="function"){if(!(b instanceof d)){a=true;}}else{if(typeof d=="object"&&d!==null){if(!(b instanceof d.constructor)||b.message!=d.message){a=true;}}else{a=true;}}}if(a){throw new YUITest.UnexpectedError(b);}else{return;}}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(c,"Error should have been thrown."));}};YUITest.ArrayAssert={_indexOf:function(b,c){if(b.indexOf){return b.indexOf(c);}else{for(var a=0;a<b.length;a++){if(b[a]===c){return a;}}return -1;}},_some:function(b,c){if(b.some){return b.some(c);}else{for(var a=0;a<b.length;a++){if(c(b[a])){return true;}}return false;}},contains:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value "+c+" ("+(typeof c)+") not found in array ["+b+"]."));}},containsItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value "+c[a]+" ("+(typeof c[a])+") not found in array ["+d+"]."));}}},containsMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"No match found in array ["+b+"]."));}},doesNotContain:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},doesNotContainItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value found in array ["+d+"]."));}}},doesNotContainMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},indexOf:function(e,d,a,c){YUITest.Assert._increment();for(var b=0;b<d.length;b++){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array ["+d+"]."));},itemsAreEqual:function(c,d,b){YUITest.Assert._increment();if(typeof c!="object"||typeof d!="object"){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value should be an array."));}if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length+"."));}for(var a=0;a<c.length;a++){if(c[a]!=d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not equal."),c[a],d[a]);}}},itemsAreEquivalent:function(d,e,a,c){YUITest.Assert._increment();if(typeof a!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(d.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Array should have a length of "+d.length+" but has a length of "+e.length));}for(var b=0;b<d.length;b++){if(!a(d[b],e[b])){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values in position "+b+" are not equivalent."),d[b],e[b]);}}},isEmpty:function(b,a){YUITest.Assert._increment();if(b.length>0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should be empty."));}},isNotEmpty:function(b,a){YUITest.Assert._increment();if(b.length===0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should not be empty."));}},itemsAreSame:function(c,d,b){YUITest.Assert._increment();if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length));}for(var a=0;a<c.length;a++){if(c[a]!==d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not the same."),c[a],d[a]);
}}},lastIndexOf:function(e,d,a,c){for(var b=d.length;b>=0;b--){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array."));}};YUITest.ObjectAssert={areEqual:function(d,f,c){YUITest.Assert._increment();var b=YUITest.Object.keys(d),e=YUITest.Object.keys(f);if(b.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Object should have "+b.length+" keys but has "+e.length));}for(var a in d){if(d.hasOwnProperty(a)){if(d[a]!=f[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values should be equal for property "+a),d[a],f[a]);}}}},hasKey:function(a,b,c){YUITest.ObjectAssert.ownsOrInheritsKey(a,b,c);},hasKeys:function(b,a,c){YUITest.ObjectAssert.ownsOrInheritsKeys(b,a,c);},inheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b&&!b.hasOwnProperty(a))){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},inheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(propertyName in a&&!a.hasOwnProperty(c[b]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsKey:function(a,b,c){YUITest.Assert._increment();if(!b.hasOwnProperty(a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},ownsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!a.hasOwnProperty(c[b])){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsNoKeys:function(b,d){YUITest.Assert._increment();var c=0,a;for(a in b){if(b.hasOwnProperty(a)){c++;}}if(c!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Object owns "+c+" properties but should own none."));}},ownsOrInheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object."));}},ownsOrInheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(c[b] in a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getFullYear()!=d.getFullYear()){c="Years should be equal.";}if(b.getMonth()!=d.getMonth()){c="Months should be equal.";}if(b.getDate()!=d.getDate()){c="Days of month should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getHours()!=d.getHours()){c="Hours should be equal.";}if(b.getMinutes()!=d.getMinutes()){c="Minutes should be equal.";}if(b.getSeconds()!=d.getSeconds()){c="Seconds should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(d){d=d||{};var a,b;try{function e(){}e.prototype=d;a=new e();}catch(c){a={};}for(b in d){if(d.hasOwnProperty(b)){if(typeof d[b]=="function"){a[b]=function(f){return function(){YUITest.Assert.fail("Method "+f+"() was called but was not expected to be.");};}(b);}}}return a;};YUITest.Mock.expect=function(g,c){if(!g.__expectations){g.__expectations={};}if(c.method){var a=c.method,h=c.args||[],k=c.returns,f=(typeof c.callCount=="number")?c.callCount:1,j=c.error,d=c.run||function(){},b,e;g.__expectations[a]=c;c.callCount=f;c.actualCallCount=0;for(e=0;e<h.length;e++){if(!(h[e] instanceof YUITest.Mock.Value)){h[e]=YUITest.Mock.Value(YUITest.Assert.areSame,[h[e]],"Argument "+e+" of "+a+"() is incorrect.");}}if(f>0){g[a]=function(){try{c.actualCallCount++;YUITest.Assert.areEqual(h.length,arguments.length,"Method "+a+"() passed incorrect number of arguments.");for(var n=0,l=h.length;n<l;n++){h[n].verify(arguments[n]);}b=d.apply(this,arguments);if(j){throw j;}}catch(m){YUITest.TestRunner._handleError(m);}return c.hasOwnProperty("returns")?k:b;};}else{g[a]=function(){try{YUITest.Assert.fail("Method "+a+"() should not have been called.");}catch(i){YUITest.TestRunner._handleError(i);}};}}else{if(c.property){g.__expectations[c.property]=c;}}};YUITest.Mock.verify=function(a){try{for(var c in a.__expectations){if(a.__expectations.hasOwnProperty(c)){var b=a.__expectations[c];if(b.method){YUITest.Assert.areEqual(b.callCount,b.actualCallCount,"Method "+b.method+"() wasn't called the expected number of times.");}else{if(b.property){YUITest.Assert.areEqual(b.value,a[b.property],"Property "+b.property+" wasn't set to the correct value.");}}}}}catch(d){YUITest.TestRunner._handleError(d);}};YUITest.Mock.Value=function(c,a,b){if(this instanceof YUITest.Mock.Value){this.verify=function(e){var d=[].concat(a||[]);d.push(e);d.push(b);c.apply(null,d);};}else{return new YUITest.Mock.Value(c,a,b);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(a){this.name=a;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(a){this.passed+=a.passed;this.failed+=a.failed;this.ignored+=a.ignored;this.total+=a.total;this.errors+=a.errors;};YUITest.TestCase=function(a){this._should={};
for(var b in a){this[b]=a[b];}if(typeof this.name!="string"){this.name=YUITest.guid("testCase_");}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);},resume:function(a){YUITest.TestRunner.resume(a);},wait:function(c,a){var b=(typeof c=="number"?c:a);b=(typeof b=="number"?b:10000);if(typeof c=="function"){throw new YUITest.Wait(c,b);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},b);}},assert:function(b,a){YUITest.Assert._increment();if(!b){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Assertion failed."));}},fail:function(a){YUITest.Assert.fail(a);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(a){this.name="";this.items=[];if(typeof a=="string"){this.name=a;}else{if(a instanceof Object){for(var b in a){if(a.hasOwnProperty(b)){this[b]=a[b];}}}}if(this.name===""||!this.name){this.name=YUITest.guid("testSuite_");}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(a){if(a instanceof YUITest.TestSuite||a instanceof YUITest.TestCase){this.items.push(a);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function a(b){return b.replace(/[<>"'&]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";}});}return{JSON:function(b){return YUITest.Util.JSON.stringify(b);},XML:function(c){function b(e){var d="<"+e.type+' name="'+a(e.name)+'"';if(typeof(e.duration)=="number"){d+=' duration="'+e.duration+'"';}if(e.type=="test"){d+=' result="'+e.result+'" message="'+a(e.message)+'">';}else{d+=' passed="'+e.passed+'" failed="'+e.failed+'" ignored="'+e.ignored+'" total="'+e.total+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=b(e[f]);}}}}d+="</"+e.type+">";return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+b(c);},JUnitXML:function(b){function c(e){var d="";switch(e.type){case"test":if(e.result!="ignore"){d='<testcase name="'+a(e.name)+'" time="'+(e.duration/1000)+'">';if(e.result=="fail"){d+='<failure message="'+a(e.message)+'"><![CDATA['+e.message+"]]></failure>";}d+="</testcase>";}break;case"testcase":d='<testsuite name="'+a(e.name)+'" tests="'+e.total+'" failures="'+e.failed+'" time="'+(e.duration/1000)+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuite>";break;case"testsuite":for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}break;case"report":d="<testsuites>";for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuites>";}return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+c(b);},TAP:function(c){var d=1;function b(e){var f="";switch(e.type){case"test":if(e.result!="ignore"){f="ok "+(d++)+" - "+e.name;if(e.result=="fail"){f="not "+f+" - "+e.message;}f+="\n";}else{f="#Ignored test "+e.name+"\n";}break;case"testcase":f="#Begin testcase "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testcase "+e.name+"\n";break;case"testsuite":f="#Begin testsuite "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testsuite "+e.name+"\n";break;case"report":for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}}return f;}return"1.."+c.total+"\n"+b(c);}};}();YUITest.CoverageFormat={JSON:function(a){return YUITest.Util.JSON.stringify(a);},XdebugJSON:function(b){var a={};for(var c in b){if(b.hasOwnProperty(c)){a[c]=b[c].lines;}}return YUITest.Util.JSON.stringify(b);}};YUITest.TestRunner=function(){function c(e,g){if(!g.length){return true;}else{if(e){for(var f=0,d=e.length;f<d;f++){if(g.indexOf(","+e[f]+",")>-1){return true;}}}return false;}}function b(d){this.testObject=d;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results=new YUITest.Results();if(d instanceof YUITest.TestSuite){this.results.type="testsuite";this.results.name=d.name;}else{if(d instanceof YUITest.TestCase){this.results.type="testcase";this.results.name=d.name;}}}b.prototype={appendChild:function(d){var e=new b(d);if(this.firstChild===null){this.firstChild=this.lastChild=e;}else{this.lastChild.next=e;this.lastChild=e;}e.parent=this;return e;}};function a(){YUITest.EventTarget.call(this);this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));this._cur=null;this._root=null;this._log=true;this._waiting=false;this._running=false;this._lastResults=null;this._context=null;this._groups="";}a.prototype=YUITest.Util.mix(new YUITest.EventTarget(),{_ignoreEmpty:false,constructor:YUITest.TestRunner,TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",ERROR_EVENT:"error",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(e,f){var g=e.appendChild(f),h,d;for(h in f){if((h.indexOf("test")===0||h.indexOf(" ")>-1)&&typeof f[h]=="function"){g.appendChild(h);}}},_addTestSuiteToTestTree:function(d,g){var f=d.appendChild(g);for(var e=0;e<g.items.length;e++){if(g.items[e] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(f,g.items[e]);}else{if(g.items[e] instanceof YUITest.TestCase){this._addTestCaseToTestTree(f,g.items[e]);}}}},_buildTestTree:function(){this._root=new b(this.masterSuite);for(var d=0;d<this.masterSuite.items.length;d++){if(this.masterSuite.items[d] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[d]);
-}else{if(this.masterSuite.items[d] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[d]);}}}},_handleTestObjectComplete:function(e){var d;if(e&&(typeof e.testObject=="object")){d=e.parent;if(d){d.results.include(e.results);d.results[e.testObject.name]=e.results;}if(e.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(e,"tearDown",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:e.testObject,results:e.results});}else{if(e.testObject instanceof YUITest.TestCase){this._execNonTestMethod(e,"destroy",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:e.testObject,results:e.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{if(this._cur){this._cur=this._cur.next;}}}}}return this._cur;},_execNonTestMethod:function(h,d,i){var e=h.testObject,g={type:this.ERROR_EVENT};try{if(i&&e["async:"+d]){e["async:"+d](this._context);return true;}else{e[d](this._context);}}catch(f){h.results.errors++;g.error=f;g.methodName=d;if(e instanceof YUITest.TestCase){g.testCase=e;}else{g.testSuite=testSuite;}this.fire(g);}return false;},_run:function(){var f=false;var e=this._next();if(e!==null){this._running=true;this._lastResult=null;var d=e.testObject;if(typeof d=="object"&&d!==null){if(d instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:d});e._start=new Date();this._execNonTestMethod(e,"setUp",false);}else{if(d instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:d});e._start=new Date();if(this._execNonTestMethod(e,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(e);}}},_resumeTest:function(i){var d=this._cur;this._waiting=false;if(!d){return;}var j=d.testObject;var g=d.parent.testObject;if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}var m=j.indexOf("fail:")===0||(g._should.fail||{})[j];var e=(g._should.error||{})[j];var h=false;var k=null;try{i.call(g,this._context);if(YUITest.Assert._getCount()==0&&!this._ignoreEmpty){throw new YUITest.AssertionError("Test has no asserts.");}else{if(m){k=new YUITest.ShouldFail();h=true;}else{if(e){k=new YUITest.ShouldError();h=true;}}}}catch(l){if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}if(l instanceof YUITest.AssertionError){if(!m){k=l;h=true;}}else{if(l instanceof YUITest.Wait){if(typeof l.segment=="function"){if(typeof l.delay=="number"){if(typeof setTimeout!="undefined"){g.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(l.segment);},l.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!e){k=new YUITest.UnexpectedError(l);h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(d){if(!this._running&&typeof _yuitest_coverage=="object"){if(typeof d=="function"){return d(_yuitest_coverage);}else{return _yuitest_coverage;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};
-var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];}f._groups=(e.groups instanceof Array)?","+e.groups.join(",")+",":"";f._buildTestTree();f._context={};f._root._start=new Date();f.fire(f.BEGIN_EVENT);f._run();}});return new a();}();
+}else{if(this.masterSuite.items[d] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[d]);}}}},_handleTestObjectComplete:function(e){var d;if(e&&(typeof e.testObject=="object")){d=e.parent;if(d){d.results.include(e.results);d.results[e.testObject.name]=e.results;}if(e.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(e,"tearDown",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:e.testObject,results:e.results});}else{if(e.testObject instanceof YUITest.TestCase){this._execNonTestMethod(e,"destroy",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:e.testObject,results:e.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{if(this._cur){this._cur=this._cur.next;}}}}}return this._cur;},_execNonTestMethod:function(h,d,i){var e=h.testObject,g={type:this.ERROR_EVENT};try{if(i&&e["async:"+d]){e["async:"+d](this._context);return true;}else{e[d](this._context);}}catch(f){h.results.errors++;g.error=f;g.methodName=d;if(e instanceof YUITest.TestCase){g.testCase=e;}else{g.testSuite=testSuite;}this.fire(g);}return false;},_run:function(){var f=false;var e=this._next();if(e!==null){this._running=true;this._lastResult=null;var d=e.testObject;if(typeof d=="object"&&d!==null){if(d instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:d});e._start=new Date();this._execNonTestMethod(e,"setUp",false);}else{if(d instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:d});e._start=new Date();if(this._execNonTestMethod(e,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(e);}}},_resumeTest:function(i){var d=this._cur;this._waiting=false;if(!d){return;}var j=d.testObject;var g=d.parent.testObject;if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}var m=j.indexOf("fail:")===0||(g._should.fail||{})[j];var e=(g._should.error||{})[j];var h=false;var k=null;try{i.call(g,this._context);if(YUITest.Assert._getCount()==0&&!this._ignoreEmpty){throw new YUITest.AssertionError("Test has no asserts.");}else{if(m){k=new YUITest.ShouldFail();h=true;}else{if(e){k=new YUITest.ShouldError();h=true;}}}}catch(l){if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}if(l instanceof YUITest.AssertionError){if(!m){k=l;h=true;}}else{if(l instanceof YUITest.Wait){if(typeof l.segment=="function"){if(typeof l.delay=="number"){if(typeof setTimeout!="undefined"){g.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(l.segment);},l.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!e){k=new YUITest.UnexpectedError(l);h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(e){var d=null;if(typeof _yuitest_coverage==="object"){d=_yuitest_coverage;}if(typeof __coverage__==="object"){d=__coverage__;}if(!this._running&&typeof d=="object"){if(typeof e=="function"){return e(d);}else{return d;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});
+}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];}f._groups=(e.groups instanceof Array)?","+e.groups.join(",")+",":"";f._buildTestTree();f._context={};f._root._start=new Date();f.fire(f.BEGIN_EVENT);f._run();}});return new a();}();
View
21 javascript/build/yuitest/yuitest-node.js
@@ -10,7 +10,7 @@
*/
var YUITest = exports;
-YUITest.version = "0.7.8";
+YUITest.version = "0.7.9";
//backwards compatibility
exports.YUITest = YUITest;
@@ -1995,7 +1995,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -3451,12 +3451,19 @@ YUITest.CoverageFormat = {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
View
24 javascript/build/yuitest/yuitest-rhino-cli-debug.js
@@ -10,7 +10,7 @@
*/
var YUITest = {
- version: "0.7.8",
+ version: "0.7.9",
_idx: 0,
guid: function(pre) {
var id = (new Date()).getTime() + '_' + (++YUITest._idx);
@@ -1992,7 +1992,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -3448,12 +3448,19 @@ YUITest.CoverageFormat = {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
@@ -3989,6 +3996,9 @@ YUITest.Util.mix(YUITest.CLI, {
this.processArguments();
this.processFiles();
+ YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT, function(event) {
+ YUITest.CLI.quit(event.results.failed ? 1 : 0);
+ });
YUITest.TestRunner.run({
groups: this.options.groups ? this.options.groups.split(",") : null
View
6 javascript/build/yuitest/yuitest-rhino-cli-min.js
@@ -1,7 +1,7 @@
-var YUITest={version:"0.7.8",_idx:0,guid:function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;}};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();if(b!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be null."),null,b);
+var YUITest={version:"0.7.9",_idx:0,guid:function(a){var b=(new Date()).getTime()+"_"+(++YUITest._idx);return(a)?(a+b):b;}};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(a,b){if(typeof this._handlers[a]=="undefined"){this._handlers[a]=[];}this._handlers[a].push(b);},subscribe:function(a,b){this.attach.apply(this,arguments);},fire:function(d){if(typeof d=="string"){d={type:d};}if(!d.target){d.target=this;}if(!d.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[d.type] instanceof Array){var b=this._handlers[d.type];for(var c=0,a=b.length;c<a;c++){b[c].call(this,d);}}},detach:function(d,e){if(this._handlers[d] instanceof Array){var b=this._handlers[d];for(var c=0,a=b.length;c<a;c++){if(b[c]===e){b.splice(c,1);break;}}}},unsubscribe:function(a,b){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(b,a){for(var c in a){if(a.hasOwnProperty(c)){b[c]=a[c];}}return b;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.Object={_forceEnum:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],_hasEnumBug:!{valueOf:0}.propertyIsEnumerable("valueOf"),_isObject:function(c,b){var a=typeof c;return(c&&(a==="object"||(!b&&(a==="function"||typeof a==="function"))))||false;},keys:Object.keys||function(e){if(!YUITest.Object.isObject(e)){throw new TypeError("Object.keys called on a non-object");}var d=[],c,b,a;for(b in e){if(owns(e,b)){d.push(b);}}if(YUITest.Object._hasEnumBug){for(c=0,a=YUITest.Object._forceEnum.length;c<a;++c){b=YUITest.Object._forceEnum[c];if(owns(e,b)){d.push(b);}}}return d;}};YUITest.AssertionError=function(a){this.message=a;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(b,a,c){YUITest.AssertionError.call(this,b);this.expected=a;this.actual=c;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(a){YUITest.AssertionError.call(this,a||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(a){YUITest.AssertionError.call(this,a||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(a){YUITest.AssertionError.call(this,"Unexpected error: "+a.message);this.cause=a;this.name="UnexpectedError";this.stack=a.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(b,a){YUITest.AssertionError.call(this,b);this.unexpected=a;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(b,a){this.segment=(typeof b=="function"?b:null);this.delay=(typeof a=="number"?a:0);};YUITest.Assert={_asserts:0,_formatMessage:function(b,a){if(typeof b=="string"&&b.length>0){return b.replace("{message}",a);}else{return a;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(a){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Test force-failed."));},pass:function(a){YUITest.Assert._increment();},areEqual:function(b,c,a){YUITest.Assert._increment();if(b!=c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be equal."),b,c);}},areNotEqual:function(a,c,b){YUITest.Assert._increment();if(a==c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be equal."),a);}},areNotSame:function(a,c,b){YUITest.Assert._increment();if(a===c){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Values should not be the same."),a);}},areSame:function(b,c,a){YUITest.Assert._increment();if(b!==c){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Values should be the same."),b,c);}},isFalse:function(b,a){YUITest.Assert._increment();if(false!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be false."),false,b);}},isTrue:function(b,a){YUITest.Assert._increment();if(true!==b){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be true."),true,b);}},isNaN:function(b,a){YUITest.Assert._increment();if(!isNaN(b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be NaN."),NaN,b);}},isNotNaN:function(b,a){YUITest.Assert._increment();if(isNaN(b)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be NaN."),NaN);}},isNotNull:function(b,a){YUITest.Assert._increment();if(b===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Values should not be null."),null);}},isNotUndefined:function(b,a){YUITest.Assert._increment();if(typeof b=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should not be undefined."),undefined);}},isNull:function(b,a){YUITest.Assert._increment();if(b!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be null."),null,b);
}},isUndefined:function(b,a){YUITest.Assert._increment();if(typeof b!="undefined"){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value should be undefined."),undefined,b);}},isArray:function(c,b){YUITest.Assert._increment();var a=false;if(Array.isArray){a=!Array.isArray(c);}else{a=Object.prototype.toString.call(c)!="[object Array]";}if(a){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(b,"Value should be an array."),c);}},isBoolean:function(b,a){YUITest.Assert._increment();if(typeof b!="boolean"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a Boolean."),b);}},isFunction:function(b,a){YUITest.Assert._increment();if(!(b instanceof Function)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a function."),b);}},isInstanceOf:function(b,c,a){YUITest.Assert._increment();if(!(c instanceof b)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,"Value isn't an instance of expected type."),b,c);}},isNumber:function(b,a){YUITest.Assert._increment();if(typeof b!="number"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a number."),b);}},isObject:function(b,a){YUITest.Assert._increment();if(!b||(typeof b!="object"&&typeof b!="function")){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be an object."),b);}},isString:function(b,a){YUITest.Assert._increment();if(typeof b!="string"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(a,"Value should be a string."),b);}},isTypeOf:function(a,c,b){YUITest.Assert._increment();if(typeof c!=a){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Value should be of type "+a+"."),a,typeof c);}},throwsError:function(d,e,c){YUITest.Assert._increment();var a=false;try{e();}catch(b){if(typeof d=="string"){if(b.message!=d){a=true;}}else{if(typeof d=="function"){if(!(b instanceof d)){a=true;}}else{if(typeof d=="object"&&d!==null){if(!(b instanceof d.constructor)||b.message!=d.message){a=true;}}else{a=true;}}}if(a){throw new YUITest.UnexpectedError(b);}else{return;}}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(c,"Error should have been thrown."));}};YUITest.ArrayAssert={_indexOf:function(b,c){if(b.indexOf){return b.indexOf(c);}else{for(var a=0;a<b.length;a++){if(b[a]===c){return a;}}return -1;}},_some:function(b,c){if(b.some){return b.some(c);}else{for(var a=0;a<b.length;a++){if(c(b[a])){return true;}}return false;}},contains:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value "+c+" ("+(typeof c)+") not found in array ["+b+"]."));}},containsItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value "+c[a]+" ("+(typeof c[a])+") not found in array ["+d+"]."));}}},containsMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"No match found in array ["+b+"]."));}},doesNotContain:function(c,b,a){YUITest.Assert._increment();if(this._indexOf(b,c)>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},doesNotContainItems:function(c,d,b){YUITest.Assert._increment();for(var a=0;a<c.length;a++){if(this._indexOf(d,c[a])>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value found in array ["+d+"]."));}}},doesNotContainMatch:function(c,b,a){YUITest.Assert._increment();if(typeof c!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(this._some(b,c)){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Value found in array ["+b+"]."));}},indexOf:function(e,d,a,c){YUITest.Assert._increment();for(var b=0;b<d.length;b++){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array ["+d+"]."));},itemsAreEqual:function(c,d,b){YUITest.Assert._increment();if(typeof c!="object"||typeof d!="object"){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Value should be an array."));}if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length+"."));}for(var a=0;a<c.length;a++){if(c[a]!=d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not equal."),c[a],d[a]);}}},itemsAreEquivalent:function(d,e,a,c){YUITest.Assert._increment();if(typeof a!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(d.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Array should have a length of "+d.length+" but has a length of "+e.length));}for(var b=0;b<d.length;b++){if(!a(d[b],e[b])){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values in position "+b+" are not equivalent."),d[b],e[b]);}}},isEmpty:function(b,a){YUITest.Assert._increment();if(b.length>0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should be empty."));}},isNotEmpty:function(b,a){YUITest.Assert._increment();if(b.length===0){YUITest.Assert.fail(YUITest.Assert._formatMessage(a,"Array should not be empty."));}},itemsAreSame:function(c,d,b){YUITest.Assert._increment();if(c.length!=d.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(b,"Array should have a length of "+c.length+" but has a length of "+d.length));}for(var a=0;a<c.length;a++){if(c[a]!==d[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(b,"Values in position "+a+" are not the same."),c[a],d[a]);}}},lastIndexOf:function(e,d,a,c){for(var b=d.length;b>=0;b--){if(d[b]===e){if(a!=b){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value exists at index "+b+" but should be at index "+a+"."));
}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Value doesn't exist in array."));}};YUITest.ObjectAssert={areEqual:function(d,f,c){YUITest.Assert._increment();var b=YUITest.Object.keys(d),e=YUITest.Object.keys(f);if(b.length!=e.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Object should have "+b.length+" keys but has "+e.length));}for(var a in d){if(d.hasOwnProperty(a)){if(d[a]!=f[a]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(c,"Values should be equal for property "+a),d[a],f[a]);}}}},hasKey:function(a,b,c){YUITest.ObjectAssert.ownsOrInheritsKey(a,b,c);},hasKeys:function(b,a,c){YUITest.ObjectAssert.ownsOrInheritsKeys(b,a,c);},inheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b&&!b.hasOwnProperty(a))){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},inheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(propertyName in a&&!a.hasOwnProperty(c[b]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsKey:function(a,b,c){YUITest.Assert._increment();if(!b.hasOwnProperty(a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object instance."));}},ownsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!a.hasOwnProperty(c[b])){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object instance."));}}},ownsNoKeys:function(b,d){YUITest.Assert._increment();var c=0,a;for(a in b){if(b.hasOwnProperty(a)){c++;}}if(c!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Object owns "+c+" properties but should own none."));}},ownsOrInheritsKey:function(a,b,c){YUITest.Assert._increment();if(!(a in b)){YUITest.Assert.fail(YUITest.Assert._formatMessage(c,"Property '"+a+"' not found on object."));}},ownsOrInheritsKeys:function(c,a,d){YUITest.Assert._increment();for(var b=0;b<c.length;b++){if(!(c[b] in a)){YUITest.Assert.fail(YUITest.Assert._formatMessage(d,"Property '"+c[b]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getFullYear()!=d.getFullYear()){c="Years should be equal.";}if(b.getMonth()!=d.getMonth()){c="Months should be equal.";}if(b.getDate()!=d.getDate()){c="Days of month should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(b,d,a){YUITest.Assert._increment();if(b instanceof Date&&d instanceof Date){var c="";if(b.getHours()!=d.getHours()){c="Hours should be equal.";}if(b.getMinutes()!=d.getMinutes()){c="Minutes should be equal.";}if(b.getSeconds()!=d.getSeconds()){c="Seconds should be equal.";}if(c.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(a,c),b,d);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(d){d=d||{};var a,b;try{function e(){}e.prototype=d;a=new e();}catch(c){a={};}for(b in d){if(d.hasOwnProperty(b)){if(typeof d[b]=="function"){a[b]=function(f){return function(){YUITest.Assert.fail("Method "+f+"() was called but was not expected to be.");};}(b);}}}return a;};YUITest.Mock.expect=function(g,c){if(!g.__expectations){g.__expectations={};}if(c.method){var a=c.method,h=c.args||[],k=c.returns,f=(typeof c.callCount=="number")?c.callCount:1,j=c.error,d=c.run||function(){},b,e;g.__expectations[a]=c;c.callCount=f;c.actualCallCount=0;for(e=0;e<h.length;e++){if(!(h[e] instanceof YUITest.Mock.Value)){h[e]=YUITest.Mock.Value(YUITest.Assert.areSame,[h[e]],"Argument "+e+" of "+a+"() is incorrect.");}}if(f>0){g[a]=function(){try{c.actualCallCount++;YUITest.Assert.areEqual(h.length,arguments.length,"Method "+a+"() passed incorrect number of arguments.");for(var n=0,l=h.length;n<l;n++){h[n].verify(arguments[n]);}b=d.apply(this,arguments);if(j){throw j;}}catch(m){YUITest.TestRunner._handleError(m);}return c.hasOwnProperty("returns")?k:b;};}else{g[a]=function(){try{YUITest.Assert.fail("Method "+a+"() should not have been called.");}catch(i){YUITest.TestRunner._handleError(i);}};}}else{if(c.property){g.__expectations[c.property]=c;}}};YUITest.Mock.verify=function(a){try{for(var c in a.__expectations){if(a.__expectations.hasOwnProperty(c)){var b=a.__expectations[c];if(b.method){YUITest.Assert.areEqual(b.callCount,b.actualCallCount,"Method "+b.method+"() wasn't called the expected number of times.");}else{if(b.property){YUITest.Assert.areEqual(b.value,a[b.property],"Property "+b.property+" wasn't set to the correct value.");}}}}}catch(d){YUITest.TestRunner._handleError(d);}};YUITest.Mock.Value=function(c,a,b){if(this instanceof YUITest.Mock.Value){this.verify=function(e){var d=[].concat(a||[]);d.push(e);d.push(b);c.apply(null,d);};}else{return new YUITest.Mock.Value(c,a,b);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(a){this.name=a;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(a){this.passed+=a.passed;this.failed+=a.failed;this.ignored+=a.ignored;this.total+=a.total;this.errors+=a.errors;};YUITest.TestCase=function(a){this._should={};for(var b in a){this[b]=a[b];}if(typeof this.name!="string"){this.name=YUITest.guid("testCase_");}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);
},resume:function(a){YUITest.TestRunner.resume(a);},wait:function(c,a){var b=(typeof c=="number"?c:a);b=(typeof b=="number"?b:10000);if(typeof c=="function"){throw new YUITest.Wait(c,b);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},b);}},assert:function(b,a){YUITest.Assert._increment();if(!b){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(a,"Assertion failed."));}},fail:function(a){YUITest.Assert.fail(a);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(a){this.name="";this.items=[];if(typeof a=="string"){this.name=a;}else{if(a instanceof Object){for(var b in a){if(a.hasOwnProperty(b)){this[b]=a[b];}}}}if(this.name===""||!this.name){this.name=YUITest.guid("testSuite_");}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(a){if(a instanceof YUITest.TestSuite||a instanceof YUITest.TestCase){this.items.push(a);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function a(b){return b.replace(/[<>"'&]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";}});}return{JSON:function(b){return YUITest.Util.JSON.stringify(b);},XML:function(c){function b(e){var d="<"+e.type+' name="'+a(e.name)+'"';if(typeof(e.duration)=="number"){d+=' duration="'+e.duration+'"';}if(e.type=="test"){d+=' result="'+e.result+'" message="'+a(e.message)+'">';}else{d+=' passed="'+e.passed+'" failed="'+e.failed+'" ignored="'+e.ignored+'" total="'+e.total+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=b(e[f]);}}}}d+="</"+e.type+">";return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+b(c);},JUnitXML:function(b){function c(e){var d="";switch(e.type){case"test":if(e.result!="ignore"){d='<testcase name="'+a(e.name)+'" time="'+(e.duration/1000)+'">';if(e.result=="fail"){d+='<failure message="'+a(e.message)+'"><![CDATA['+e.message+"]]></failure>";}d+="</testcase>";}break;case"testcase":d='<testsuite name="'+a(e.name)+'" tests="'+e.total+'" failures="'+e.failed+'" time="'+(e.duration/1000)+'">';for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuite>";break;case"testsuite":for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}break;case"report":d="<testsuites>";for(var f in e){if(e.hasOwnProperty(f)){if(e[f]&&typeof e[f]=="object"&&!(e[f] instanceof Array)){d+=c(e[f]);}}}d+="</testsuites>";}return d;}return'<?xml version="1.0" encoding="UTF-8"?>'+c(b);},TAP:function(c){var d=1;function b(e){var f="";switch(e.type){case"test":if(e.result!="ignore"){f="ok "+(d++)+" - "+e.name;if(e.result=="fail"){f="not "+f+" - "+e.message;}f+="\n";}else{f="#Ignored test "+e.name+"\n";}break;case"testcase":f="#Begin testcase "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testcase "+e.name+"\n";break;case"testsuite":f="#Begin testsuite "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}f+="#End testsuite "+e.name+"\n";break;case"report":for(var g in e){if(e.hasOwnProperty(g)){if(e[g]&&typeof e[g]=="object"&&!(e[g] instanceof Array)){f+=b(e[g]);}}}}return f;}return"1.."+c.total+"\n"+b(c);}};}();YUITest.CoverageFormat={JSON:function(a){return YUITest.Util.JSON.stringify(a);},XdebugJSON:function(b){var a={};for(var c in b){if(b.hasOwnProperty(c)){a[c]=b[c].lines;}}return YUITest.Util.JSON.stringify(b);}};YUITest.TestRunner=function(){function c(e,g){if(!g.length){return true;}else{if(e){for(var f=0,d=e.length;f<d;f++){if(g.indexOf(","+e[f]+",")>-1){return true;}}}return false;}}function b(d){this.testObject=d;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results=new YUITest.Results();if(d instanceof YUITest.TestSuite){this.results.type="testsuite";this.results.name=d.name;}else{if(d instanceof YUITest.TestCase){this.results.type="testcase";this.results.name=d.name;}}}b.prototype={appendChild:function(d){var e=new b(d);if(this.firstChild===null){this.firstChild=this.lastChild=e;}else{this.lastChild.next=e;this.lastChild=e;}e.parent=this;return e;}};function a(){YUITest.EventTarget.call(this);this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));this._cur=null;this._root=null;this._log=true;this._waiting=false;this._running=false;this._lastResults=null;this._context=null;this._groups="";}a.prototype=YUITest.Util.mix(new YUITest.EventTarget(),{_ignoreEmpty:false,constructor:YUITest.TestRunner,TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",ERROR_EVENT:"error",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(e,f){var g=e.appendChild(f),h,d;for(h in f){if((h.indexOf("test")===0||h.indexOf(" ")>-1)&&typeof f[h]=="function"){g.appendChild(h);}}},_addTestSuiteToTestTree:function(d,g){var f=d.appendChild(g);for(var e=0;e<g.items.length;e++){if(g.items[e] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(f,g.items[e]);}else{if(g.items[e] instanceof YUITest.TestCase){this._addTestCaseToTestTree(f,g.items[e]);}}}},_buildTestTree:function(){this._root=new b(this.masterSuite);for(var d=0;d<this.masterSuite.items.length;d++){if(this.masterSuite.items[d] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[d]);}else{if(this.masterSuite.items[d] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[d]);}}}},_handleTestObjectComplete:function(e){var d;
-if(e&&(typeof e.testObject=="object")){d=e.parent;if(d){d.results.include(e.results);d.results[e.testObject.name]=e.results;}if(e.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(e,"tearDown",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:e.testObject,results:e.results});}else{if(e.testObject instanceof YUITest.TestCase){this._execNonTestMethod(e,"destroy",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:e.testObject,results:e.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{if(this._cur){this._cur=this._cur.next;}}}}}return this._cur;},_execNonTestMethod:function(h,d,i){var e=h.testObject,g={type:this.ERROR_EVENT};try{if(i&&e["async:"+d]){e["async:"+d](this._context);return true;}else{e[d](this._context);}}catch(f){h.results.errors++;g.error=f;g.methodName=d;if(e instanceof YUITest.TestCase){g.testCase=e;}else{g.testSuite=testSuite;}this.fire(g);}return false;},_run:function(){var f=false;var e=this._next();if(e!==null){this._running=true;this._lastResult=null;var d=e.testObject;if(typeof d=="object"&&d!==null){if(d instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:d});e._start=new Date();this._execNonTestMethod(e,"setUp",false);}else{if(d instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:d});e._start=new Date();if(this._execNonTestMethod(e,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(e);}}},_resumeTest:function(i){var d=this._cur;this._waiting=false;if(!d){return;}var j=d.testObject;var g=d.parent.testObject;if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}var m=j.indexOf("fail:")===0||(g._should.fail||{})[j];var e=(g._should.error||{})[j];var h=false;var k=null;try{i.call(g,this._context);if(YUITest.Assert._getCount()==0&&!this._ignoreEmpty){throw new YUITest.AssertionError("Test has no asserts.");}else{if(m){k=new YUITest.ShouldFail();h=true;}else{if(e){k=new YUITest.ShouldError();h=true;}}}}catch(l){if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}if(l instanceof YUITest.AssertionError){if(!m){k=l;h=true;}}else{if(l instanceof YUITest.Wait){if(typeof l.segment=="function"){if(typeof l.delay=="number"){if(typeof setTimeout!="undefined"){g.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(l.segment);},l.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!e){k=new YUITest.UnexpectedError(l);h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(d){if(!this._running&&typeof _yuitest_coverage=="object"){if(typeof d=="function"){return d(_yuitest_coverage);}else{return _yuitest_coverage;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];
+if(e&&(typeof e.testObject=="object")){d=e.parent;if(d){d.results.include(e.results);d.results[e.testObject.name]=e.results;}if(e.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(e,"tearDown",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:e.testObject,results:e.results});}else{if(e.testObject instanceof YUITest.TestCase){this._execNonTestMethod(e,"destroy",false);e.results.duration=(new Date())-e._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:e.testObject,results:e.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{if(this._cur){this._cur=this._cur.next;}}}}}return this._cur;},_execNonTestMethod:function(h,d,i){var e=h.testObject,g={type:this.ERROR_EVENT};try{if(i&&e["async:"+d]){e["async:"+d](this._context);return true;}else{e[d](this._context);}}catch(f){h.results.errors++;g.error=f;g.methodName=d;if(e instanceof YUITest.TestCase){g.testCase=e;}else{g.testSuite=testSuite;}this.fire(g);}return false;},_run:function(){var f=false;var e=this._next();if(e!==null){this._running=true;this._lastResult=null;var d=e.testObject;if(typeof d=="object"&&d!==null){if(d instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:d});e._start=new Date();this._execNonTestMethod(e,"setUp",false);}else{if(d instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:d});e._start=new Date();if(this._execNonTestMethod(e,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(e);}}},_resumeTest:function(i){var d=this._cur;this._waiting=false;if(!d){return;}var j=d.testObject;var g=d.parent.testObject;if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}var m=j.indexOf("fail:")===0||(g._should.fail||{})[j];var e=(g._should.error||{})[j];var h=false;var k=null;try{i.call(g,this._context);if(YUITest.Assert._getCount()==0&&!this._ignoreEmpty){throw new YUITest.AssertionError("Test has no asserts.");}else{if(m){k=new YUITest.ShouldFail();h=true;}else{if(e){k=new YUITest.ShouldError();h=true;}}}}catch(l){if(g.__yui_wait){clearTimeout(g.__yui_wait);delete g.__yui_wait;}if(l instanceof YUITest.AssertionError){if(!m){k=l;h=true;}}else{if(l instanceof YUITest.Wait){if(typeof l.segment=="function"){if(typeof l.delay=="number"){if(typeof setTimeout!="undefined"){g.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(l.segment);},l.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!e){k=new YUITest.UnexpectedError(l);h=true;}else{if(typeof e=="string"){if(l.message!=e){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="function"){if(!(l instanceof e)){k=new YUITest.UnexpectedError(l);h=true;}}else{if(typeof e=="object"&&e!==null){if(!(l instanceof e.constructor)||l.message!=e.message){k=new YUITest.UnexpectedError(l);h=true;}}}}}}}}if(h){this.fire({type:this.TEST_FAIL_EVENT,testCase:g,testName:j,error:k});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:g,testName:j});}this._execNonTestMethod(d.parent,"tearDown",false);YUITest.Assert._reset();var f=(new Date())-d._start;d.parent.results[j]={result:h?"fail":"pass",message:k?k.getMessage():"Test passed",type:"test",name:j,duration:f};if(h){d.parent.results.failed++;}else{d.parent.results.passed++;}d.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(d){if(this._waiting){this._resumeTest(function(){throw d;});}else{throw d;}},_runTest:function(g){var d=g.testObject,e=g.parent.testObject,h=e[d],f=d.indexOf("ignore:")===0||!c(e.groups,this._groups)||(e._should.ignore||{})[d];if(f){g.parent.results[d]={result:"ignore",message:"Test ignored",type:"test",name:d.indexOf("ignore:")===0?d.substring(7):d};g.parent.results.ignored++;g.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:e,testName:d});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{g._start=new Date();this._execNonTestMethod(g.parent,"setUp",false);this._resumeTest(h);}},getName:function(){return this.masterSuite.name;},setName:function(d){this.masterSuite.name=d;},add:function(d){this.masterSuite.add(d);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_"));},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(d){if(!this._running&&this._lastResults){if(typeof d=="function"){return d(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(e){var d=null;if(typeof _yuitest_coverage==="object"){d=_yuitest_coverage;}if(typeof __coverage__==="object"){d=__coverage__;}if(!this._running&&typeof d=="object"){if(typeof e=="function"){return e(d);}else{return d;}}else{return null;}},callback:function(){var f=arguments,e=this._context,d=this;return function(){for(var g=0;g<arguments.length;g++){e[f[g]]=arguments[g];}d._run();};},resume:function(d){if(this._waiting){this._resumeTest(d||function(){});}else{throw new Error("resume() called without wait().");}},run:function(e){e=e||{};var f=YUITest.TestRunner,d=e.oldMode;if(!d&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];
}f._groups=(e.groups instanceof Array)?","+e.groups.join(",")+",":"";f._buildTestTree();f._context={};f._root._start=new Date();f.fire(f.BEGIN_EVENT);f._run();}});return new a();}();importPackage(java.io);importPackage(java.lang);YUITest.CLI={args:arguments,print:function(a){System.out.print(a);},println:print,warn:function(a){System.err.print(a);},quit:quit,isDirectory:function(b){var a=new File(b);return a.isDirectory();},getFiles:function(a){var b=[];function c(d){var e=d.listFiles();e.forEach(function(f){if(/\.js$/.test(f)){b.push(f.toString());}else{if(f.isDirectory()){c(f);}}});}c(new File(a));return b;},getFullPath:function(a){return(new File(a)).getCanonicalPath();},readFile:readFile,processFiles:function(){var d=this.files,c,a,b;if(d.length){for(c=0,a=d.length;c<a;c++){if(this.options.verbose){this.warn("[INFO] Loading "+d[c]+"\n");}load(d[c]);}}else{this.warn("[ERROR] No tests to run, exiting.\n");this.quit(1);}}};YUITest.CLI.Logger=function(){var c=YUITest.TestRunner,a=YUITest.CLI;function b(e){var d="";switch(e.type){case c.BEGIN_EVENT:d="Testing began at "+(new Date()).toString()+".";messageType="info";break;case c.COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;case c.TEST_FAIL_EVENT:d=e.testName+": failed.\n"+e.error.getMessage();messageType="fail";break;case c.ERROR_EVENT:d=e.methodName+": error.\n"+e.error.message;messageType="error";break;case c.TEST_IGNORE_EVENT:d=e.testName+": ignored.";messageType="ignore";break;case c.TEST_PASS_EVENT:d=e.testName+": passed.";messageType="pass";break;case c.TEST_SUITE_BEGIN_EVENT:d='Test suite "'+e.testSuite.name+'" started.';messageType="info";break;case c.TEST_SUITE_COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;case c.TEST_CASE_BEGIN_EVENT:d='Test case "'+e.testCase.name+'" started.';messageType="info";break;case c.TEST_CASE_COMPLETE_EVENT:d="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+e.results.passed+" Failed:"+e.results.failed+" Total:"+e.results.total+"("+e.results.ignored+" ignored)";messageType="info";break;default:d="Unexpected event "+e.type;messageType="info";}a.print(d+"\n");}c.subscribe(c.BEGIN_EVENT,b);c.subscribe(c.TEST_FAIL_EVENT,b);c.subscribe(c.TEST_PASS_EVENT,b);c.subscribe(c.TEST_IGNORE_EVENT,b);c.subscribe(c.TEST_CASE_BEGIN_EVENT,b);c.subscribe(c.TEST_CASE_COMPLETE_EVENT,b);c.subscribe(c.TEST_SUITE_BEGIN_EVENT,b);c.subscribe(c.TEST_SUITE_COMPLETE_EVENT,b);c.subscribe(c.COMPLETE_EVENT,b);};YUITest.CLI.XUnit=function(){var f=YUITest.TestRunner,b=YUITest.CLI,g=[],e=[],a=[];function d(k){if(k){var l=k.split("\n"),j=[],m,h;for(m=1,h=l.length;m<h;m++){if(l[m].indexOf("yuitest-node")>-1){break;}else{j.push(l[m]);}}return j.join("\n");}else{return"Unavailable.";}}function c(m){var l="",k=m.results,j,h;switch(m.type){case f.BEGIN_EVENT:l="YUITest@"+YUITest.version+"\n";if(f._groups){l+="Filtering on groups '"+f._groups.slice(1,-1)+"'\n";}break;case f.COMPLETE_EVENT:l="\nTotal tests: "+k.total+", Failures: "+k.failed+", Skipped: "+k.ignored+", Time: "+(k.duration/1000)+" seconds\n";if(e.length){l+="\nTests failed:\n";for(j=0,h=e.length;j<h;j++){l+="\n"+(j+1)+") "+e[j].name+" : "+e[j].error.getMessage()+"\n";if(e[j].error.stack){l+="Stack trace:\n"+d(e[j].error.stack)+"\n";}}l+="\n";}if(g.length){l+="\nErrors:\n";for(j=0,h=g.length;j<h;j++){l+="\n"+(j+1)+") "+g[j].name+" : "+g[j].error.message+"\n";if(g[j].error.stack){l+="Stack trace:\n"+d(g[j].error.stack)+"\n";}}l+="\n";}l+="\n\n";break;case f.TEST_FAIL_EVENT:l="F";e.push({name:a.concat([m.testName]).join(" > "),error:m.error});break;case f.ERROR_EVENT:g.push({name:a.concat([m.methodName]).join(" > "),error:m.error});break;case f.TEST_IGNORE_EVENT:l="S";break;case f.TEST_PASS_EVENT:l=".";break;case f.TEST_SUITE_BEGIN_EVENT:a.push(m.testSuite.name);break;case f.TEST_CASE_COMPLETE_EVENT:case f.TEST_SUITE_COMPLETE_EVENT:a.pop();break;case f.TEST_CASE_BEGIN_EVENT:a.push(m.testCase.name);break;}b.print(l);}f.subscribe(f.BEGIN_EVENT,c);f.subscribe(f.TEST_FAIL_EVENT,c);f.subscribe(f.TEST_PASS_EVENT,c);f.subscribe(f.ERROR_EVENT,c);f.subscribe(f.TEST_IGNORE_EVENT,c);f.subscribe(f.TEST_CASE_BEGIN_EVENT,c);f.subscribe(f.TEST_CASE_COMPLETE_EVENT,c);f.subscribe(f.TEST_SUITE_BEGIN_EVENT,c);f.subscribe(f.TEST_SUITE_COMPLETE_EVENT,c);f.subscribe(f.COMPLETE_EVENT,c);};YUITest.CLI.Format=function(d){var c=YUITest.TestRunner,a=YUITest.CLI;function b(f){var e=f.results;a.print(d(e));}c.subscribe(c.COMPLETE_EVENT,b);};YUITest.Util.mix(YUITest.CLI,{files:[],options:{verbose:false,webcompat:false,help:false,version:false,format:"xunit"},outputVersion:function(){this.print(YUITest.version+"\n");},outputHelp:function(){this.print(["\nUsage: yuitest [options] [file|dir]*"," ","Global Options"," --groups groupname Run only tests cases that are part of groupname."," --help, -h Displays this information."," --version, -v Displays the current version."," --format <format> Specifies output format (junitxml, tap, xunit)."," --verbose Display informational messages and warnings."," --webcompat Load tests designed for use in browsers."].join("\n")+"\n\n");},processArguments:function(){var b=this.args,a=b.shift(),c=[];while(a){if(a.indexOf("--")==0){this.options[a.substring(2)]=true;if(a=="--groups"||a=="--format"){this.options[a.substring(2)]=b.shift();}}else{switch(a){case"-h":this.options.help=true;break;case"-v":this.options.version=true;break;default:if(this.isDirectory(a)){c=c.concat(this.getFiles(a));}else{c.push(a);}}}a=b.shift();}if(this.options.version){this.outputVersion();this.quit(0);}if(this.options.help||c.length===0){this.outputHelp();this.quit(0);}this.files=c;switch(this.options.format){case"junitxml":if(this.options.verbose){this.warn("[INFO] Using JUnitXML output format.\n");
-}YUITest.CLI.Format(YUITest.TestFormat.JUnitXML);break;case"tap":if(this.options.verbose){this.warn("[INFO] Using TAP output format.\n");}YUITest.CLI.Format(YUITest.TestFormat.TAP);break;default:if(this.options.verbose){this.warn("[INFO] Using XUnit output format.\n");}YUITest.CLI.XUnit();}},start:function(){this.processArguments();this.processFiles();YUITest.TestRunner.run({groups:this.options.groups?this.options.groups.split(","):null});}});YUITest.CLI.start();
+}YUITest.CLI.Format(YUITest.TestFormat.JUnitXML);break;case"tap":if(this.options.verbose){this.warn("[INFO] Using TAP output format.\n");}YUITest.CLI.Format(YUITest.TestFormat.TAP);break;default:if(this.options.verbose){this.warn("[INFO] Using XUnit output format.\n");}YUITest.CLI.XUnit();}},start:function(){this.processArguments();this.processFiles();YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT,function(a){YUITest.CLI.quit(a.results.failed?1:0);});YUITest.TestRunner.run({groups:this.options.groups?this.options.groups.split(","):null});}});YUITest.CLI.start();
View
24 javascript/build/yuitest/yuitest-rhino-cli.js
@@ -10,7 +10,7 @@
*/
var YUITest = {
- version: "0.7.8",
+ version: "0.7.9",
_idx: 0,
guid: function(pre) {
var id = (new Date()).getTime() + '_' + (++YUITest._idx);
@@ -1992,7 +1992,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -3448,12 +3448,19 @@ YUITest.CoverageFormat = {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
@@ -3989,6 +3996,9 @@ YUITest.Util.mix(YUITest.CLI, {
this.processArguments();
this.processFiles();
+ YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT, function(event) {
+ YUITest.CLI.quit(event.results.failed ? 1 : 0);
+ });
YUITest.TestRunner.run({
groups: this.options.groups ? this.options.groups.split(",") : null
View
21 javascript/build/yuitest/yuitest.js
@@ -10,7 +10,7 @@
*/
var YUITest = {
- version: "0.7.8",
+ version: "0.7.9",
_idx: 0,
guid: function(pre) {
var id = (new Date()).getTime() + '_' + (++YUITest._idx);
@@ -1992,7 +1992,7 @@ YUITest.Results = function(name){
* @property duration
*/
this.duration = 0;
-}
+};
/**
* Includes results from another results object into this one.
@@ -4603,12 +4603,19 @@ YUITest.PageManager = YUITest.Util.mix(new YUITest.EventTarget(), {
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;
Please sign in to comment.
Something went wrong with that request. Please try again.