/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.testing.DocTest"],["require","dojo.string"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.testing.DocTest"]){_4._hasResource["dojox.testing.DocTest"]=true;_4.provide("dojox.testing.DocTest");_4.require("dojo.string");_4.declare("dojox.testing.DocTest",null,{errors:[],getTests:function(_7){var _8=_4.moduleUrl(_7).path;var _9=_8.substring(0,_8.length-1)+".js";var _a=_4.xhrGet({url:_9,handleAs:"text"});var _b=_4._getText(_9);return this._getTestsFromString(_b,true);},getTestsFromString:function(_c){return this._getTestsFromString(_c,false);},_getTestsFromString:function(_d,_e){var _f=_4.hitch(_4.string,"trim");var _10=_d.split("\n");var len=_10.length;var _11=[];var _12={commands:[],expectedResult:[],line:null};for(var i=0;i<len+1;i++){var l=_f(_10[i]||"");if((_e&&l.match(/^\/\/\s+>>>\s.*/))||l.match(/^\s*>>>\s.*/)){if(!_12.line){_12.line=i+1;}if(_12.expectedResult.length>0){_11.push({commands:_12.commands,expectedResult:_12.expectedResult.join("\n"),line:_12.line});_12={commands:[],expectedResult:[],line:i+1};}l=_e?_f(l).substring(2,l.length):l;l=_f(l).substring(3,l.length);_12.commands.push(_f(l));}else{if((!_e||l.match(/^\/\/\s+.*/))&&_12.commands.length&&_12.expectedResult.length==0){l=_e?_f(l).substring(3,l.length):l;_12.expectedResult.push(_f(l));}else{if(_12.commands.length>0&&_12.expectedResult.length){if(!_e||l.match(/^\/\/\s*$/)){_11.push({commands:_12.commands,expectedResult:_12.expectedResult.join("\n"),line:_12.line});}if(_e&&!l.match(/^\/\//)){_11.push({commands:_12.commands,expectedResult:_12.expectedResult.join("\n"),line:_12.line});}_12={commands:[],expectedResult:[],line:0};}}}}return _11;},run:function(_13){this.errors=[];var _14=this.getTests(_13);if(_14){this._run(_14);}},_run:function(_15){var len=_15.length;this.tests=len;var oks=0;for(var i=0;i<len;i++){var t=_15[i];var res=this.runTest(t.commands,t.expectedResult);var msg="Test "+(i+1)+": ";var _16=t.commands.join(" ");_16=(_16.length>50?_16.substr(0,50)+"...":_16);if(res.success){console.info(msg+"OK: "+_16);oks+=1;}else{this.errors.push({commands:t.commands,actual:res.actualResult,expected:t.expectedResult});console.error(msg+"Failed: "+_16,{commands:t.commands,actualResult:res.actualResult,expectedResult:t.expectedResult});}}console.info(len+" tests ran.",oks+" Success,",this.errors.length+" Errors");},runTest:function(_17,_18){var ret={success:false,actualResult:null};var _19=_17.join("\n");ret.actualResult=eval(_19);if((String(ret.actualResult)==_18)||(_4.toJson(ret.actualResult)==_18)||((_18.charAt(0)=="\"")&&(_18.charAt(_18.length-1)=="\"")&&(String(ret.actualResult)==_18.substring(1,_18.length-1)))){ret.success=true;}return ret;}});}}};});