//>>built
define("dojox/testing/DocTest",["dojo/string"],function(){return dojo.declare("dojox.testing.DocTest",null,{errors:[],getTests:function(a){a=dojo.moduleUrl(a).path;a=a.substring(0,a.length-1)+".js";dojo.xhrGet({url:a,handleAs:"text"});a=dojo._getText(a);return this._getTestsFromString(a,!0)},getTestsFromString:function(a){return this._getTestsFromString(a,!1)},_getTestsFromString:function(a,c){for(var d=dojo.hitch(dojo.string,"trim"),e=a.split("\n"),m=e.length,f=[],h=[],g=[],k=null,l=0;l<m+1;l++){var b=
d(e[l]||"");c&&b.match(/^\/\/\s+>>>\s.*/)||b.match(/^\s*>>>\s.*/)?(k||(k=l+1),0<g.length&&(f.push({commands:h,expectedResult:g.join("\n"),line:k}),h=[],g=[],k=l+1),b=c?d(b).substring(2,b.length):b,b=d(b).substring(3,b.length),h.push(d(b))):c&&!b.match(/^\/\/\s+.*/)||!h.length||0!=g.length?0<h.length&&g.length&&(c&&!b.match(/^\/\/\s*$/)||f.push({commands:h,expectedResult:g.join("\n"),line:k}),c&&!b.match(/^\/\//)&&f.push({commands:h,expectedResult:g.join("\n"),line:k}),h=[],g=[],k=0):(b=c?d(b).substring(3,
b.length):b,g.push(d(b)))}return f},run:function(a){this.errors=[];(a=this.getTests(a))&&this._run(a)},_run:function(a){var c=a.length;this.tests=c;for(var d=0;d<c;d++){var e=a[d],m=this.runTest(e.commands,e.expectedResult),f=e.commands.join(" ");f=50<f.length?f.substr(0,50)+"...":f;m.success||this.errors.push({commands:e.commands,actual:m.actualResult,expected:e.expectedResult})}},runTest:function(a,c){var d={success:!1,actualResult:null},e=a.join("\n");d.actualResult=eval(e);if(String(d.actualResult)==
c||dojo.toJson(d.actualResult)==c||'"'==c.charAt(0)&&'"'==c.charAt(c.length-1)&&String(d.actualResult)==c.substring(1,c.length-1))d.success=!0;return d}})});