SUnit.deploy.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  1. smalltalk.addClass('TestCase', smalltalk.Object, ['testedClass'], 'SUnit');
  2. smalltalk.addMethod(
  3. '_testedClass',
  4. smalltalk.method({
  5. selector: 'testedClass',
  6. fn: function (){
  7. var self=this;
  8. return self['@testedClass'];
  9. return self;}
  10. }),
  11. smalltalk.TestCase);
  12. smalltalk.addMethod(
  13. '_testedClass_',
  14. smalltalk.method({
  15. selector: 'testedClass:',
  16. fn: function (aClass){
  17. var self=this;
  18. self['@testedClass']=aClass;
  19. return self;}
  20. }),
  21. smalltalk.TestCase);
  22. smalltalk.addMethod(
  23. '_cleanUpInstanceVariables',
  24. smalltalk.method({
  25. selector: 'cleanUpInstanceVariables',
  26. fn: function (){
  27. var self=this;
  28. smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_instanceVariableNames", []), "_do_", [(function(name){return smalltalk.send(smalltalk.send(name, "__eq", ["testSelector"]), "_ifFalse_", [(function(){return smalltalk.send(self, "_instVarAt_put_", [name, nil]);})]);})]);
  29. return self;}
  30. }),
  31. smalltalk.TestCase);
  32. smalltalk.addMethod(
  33. '_signalFailure_',
  34. smalltalk.method({
  35. selector: 'signalFailure:',
  36. fn: function (aString){
  37. var self=this;
  38. (function($rec){smalltalk.send($rec, "_messageText_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send(smalltalk.TestFailure, "_new", []));
  39. return self;}
  40. }),
  41. smalltalk.TestCase);
  42. smalltalk.addMethod(
  43. '_setUp',
  44. smalltalk.method({
  45. selector: 'setUp',
  46. fn: function (){
  47. var self=this;
  48. return self;}
  49. }),
  50. smalltalk.TestCase);
  51. smalltalk.addMethod(
  52. '_tearDown',
  53. smalltalk.method({
  54. selector: 'tearDown',
  55. fn: function (){
  56. var self=this;
  57. return self;}
  58. }),
  59. smalltalk.TestCase);
  60. smalltalk.addMethod(
  61. '_methods',
  62. smalltalk.method({
  63. selector: 'methods',
  64. fn: function (){
  65. var self=this;
  66. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_methodDictionary", []), "_keys", []), "_select_", [(function(each){return smalltalk.send(each, "_match_", [unescape("%5Etest")]);})]);
  67. return self;}
  68. }),
  69. smalltalk.TestCase);
  70. smalltalk.addMethod(
  71. '_runCaseFor_',
  72. smalltalk.method({
  73. selector: 'runCaseFor:',
  74. fn: function (aTestResult){
  75. var self=this;
  76. smalltalk.send((function(){smalltalk.send(self, "_setUp", []);return smalltalk.send(self, "_performTestFor_", [aTestResult]);}), "_on_do_", [smalltalk.Error, (function(ex){smalltalk.send(self, "_tearDown", []);smalltalk.send(self, "_cleanUpInstanceVariables", []);return smalltalk.send(ex, "_signal", []);})]);
  77. smalltalk.send(self, "_tearDown", []);
  78. smalltalk.send(self, "_cleanUpInstanceVariables", []);
  79. return self;}
  80. }),
  81. smalltalk.TestCase);
  82. smalltalk.addMethod(
  83. '_performTestFor_',
  84. smalltalk.method({
  85. selector: 'performTestFor:',
  86. fn: function (aResult){
  87. var self=this;
  88. smalltalk.send(smalltalk.send(self, "_methods", []), "_do_", [(function(each){smalltalk.send((function(){return smalltalk.send((function(){return smalltalk.send(self, "_perform_", [each]);}), "_on_do_", [smalltalk.TestFailure, (function(ex){return smalltalk.send(aResult, "_addFailure_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_name", []), "__comma", [unescape("%3E%3E")]), "__comma", [each]), "__comma", [": "]), "__comma", [smalltalk.send(ex, "_messageText", [])])]);})]);}), "_on_do_", [smalltalk.Error, (function(ex){return smalltalk.send(aResult, "_addError_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_name", []), "__comma", [unescape("%3E%3E")]), "__comma", [each]), "__comma", [": "]), "__comma", [smalltalk.send(ex, "_messageText", [])])]);})]);return smalltalk.send(aResult, "_increaseRuns", []);})]);
  89. return self;}
  90. }),
  91. smalltalk.TestCase);
  92. smalltalk.addMethod(
  93. '_assert_',
  94. smalltalk.method({
  95. selector: 'assert:',
  96. fn: function (aBoolean){
  97. var self=this;
  98. smalltalk.send(self, "_assert_description_", [aBoolean, "Assertion failed"]);
  99. return self;}
  100. }),
  101. smalltalk.TestCase);
  102. smalltalk.addMethod(
  103. '_deny_',
  104. smalltalk.method({
  105. selector: 'deny:',
  106. fn: function (aBoolean){
  107. var self=this;
  108. smalltalk.send(self, "_assert_", [smalltalk.send(aBoolean, "_not", [])]);
  109. return self;}
  110. }),
  111. smalltalk.TestCase);
  112. smalltalk.addMethod(
  113. '_assert_equals_',
  114. smalltalk.method({
  115. selector: 'assert:equals:',
  116. fn: function (expected, actual){
  117. var self=this;
  118. return smalltalk.send(self, "_assert_description_", [smalltalk.send(expected, "__eq", [actual]), smalltalk.send(smalltalk.send(smalltalk.send("Expected: ", "__comma", [smalltalk.send(expected, "_asString", [])]), "__comma", [" but was: "]), "__comma", [smalltalk.send(actual, "_asString", [])])]);
  119. return self;}
  120. }),
  121. smalltalk.TestCase);
  122. smalltalk.addMethod(
  123. '_assert_description_',
  124. smalltalk.method({
  125. selector: 'assert:description:',
  126. fn: function (aBoolean, aString){
  127. var self=this;
  128. smalltalk.send(aBoolean, "_ifFalse_", [(function(){return smalltalk.send(self, "_signalFailure_", [aString]);})]);
  129. return self;}
  130. }),
  131. smalltalk.TestCase);
  132. smalltalk.addClass('ExampleTest', smalltalk.TestCase, ['test'], 'SUnit');
  133. smalltalk.addMethod(
  134. '_testFailure',
  135. smalltalk.method({
  136. selector: 'testFailure',
  137. fn: function (){
  138. var self=this;
  139. smalltalk.send(self, "_deny_", [true]);
  140. return self;}
  141. }),
  142. smalltalk.ExampleTest);
  143. smalltalk.addMethod(
  144. '_testPasses',
  145. smalltalk.method({
  146. selector: 'testPasses',
  147. fn: function (){
  148. var self=this;
  149. smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
  150. return self;}
  151. }),
  152. smalltalk.ExampleTest);
  153. smalltalk.addMethod(
  154. '_testError',
  155. smalltalk.method({
  156. selector: 'testError',
  157. fn: function (){
  158. var self=this;
  159. smalltalk.send(self, "_assert_", [smalltalk.send((1), "_foo", [])]);
  160. return self;}
  161. }),
  162. smalltalk.ExampleTest);
  163. smalltalk.addClass('ProgressBar', smalltalk.TabWidget, ['percent', 'progressDiv', 'div'], 'SUnit');
  164. smalltalk.addMethod(
  165. '_percent',
  166. smalltalk.method({
  167. selector: 'percent',
  168. fn: function (){
  169. var self=this;
  170. return smalltalk.send(self['@percent'], "_ifNil_", [(function(){return (0);})]);
  171. return self;}
  172. }),
  173. smalltalk.ProgressBar);
  174. smalltalk.addMethod(
  175. '_percent_',
  176. smalltalk.method({
  177. selector: 'percent:',
  178. fn: function (aNumber){
  179. var self=this;
  180. self['@percent']=aNumber;
  181. return self;}
  182. }),
  183. smalltalk.ProgressBar);
  184. smalltalk.addMethod(
  185. '_renderOn_',
  186. smalltalk.method({
  187. selector: 'renderOn:',
  188. fn: function (html){
  189. var self=this;
  190. self['@div']=(function($rec){smalltalk.send($rec, "_class_", ["progress_bar"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(html, "_div", []));
  191. smalltalk.send(self, "_renderProgressBar", []);
  192. return self;}
  193. }),
  194. smalltalk.ProgressBar);
  195. smalltalk.addMethod(
  196. '_updatePercent_',
  197. smalltalk.method({
  198. selector: 'updatePercent:',
  199. fn: function (aNumber){
  200. var self=this;
  201. smalltalk.send(self, "_percent_", [aNumber]);
  202. smalltalk.send(self, "_renderProgressBar", []);
  203. return self;}
  204. }),
  205. smalltalk.ProgressBar);
  206. smalltalk.addMethod(
  207. '_renderProgressBar',
  208. smalltalk.method({
  209. selector: 'renderProgressBar',
  210. fn: function (){
  211. var self=this;
  212. smalltalk.send(self['@div'], "_contents_", [(function(html){return (function($rec){smalltalk.send($rec, "_class_", ["progress"]);return smalltalk.send($rec, "_style_", [smalltalk.send(smalltalk.send("width:", "__comma", [smalltalk.send(smalltalk.send(self, "_percent", []), "_asString", [])]), "__comma", [unescape("%25")])]);})(smalltalk.send(html, "_div", []));})]);
  213. return self;}
  214. }),
  215. smalltalk.ProgressBar);
  216. smalltalk.addClass('TestFailure', smalltalk.Error, [], 'SUnit');
  217. smalltalk.addClass('TestRunner', smalltalk.TabWidget, ['selectedCategories', 'categoriesList', 'selectedClasses', 'classesList', 'selectedMethods', 'progressBar', 'methodsList', 'result', 'statusDiv'], 'SUnit');
  218. smalltalk.addMethod(
  219. '_label',
  220. smalltalk.method({
  221. selector: 'label',
  222. fn: function (){
  223. var self=this;
  224. return unescape("%5BTest%20runner%5D");
  225. return self;}
  226. }),
  227. smalltalk.TestRunner);
  228. smalltalk.addMethod(
  229. '_categories',
  230. smalltalk.method({
  231. selector: 'categories',
  232. fn: function (){
  233. var self=this;
  234. var categories=nil;
  235. categories=smalltalk.send(smalltalk.Array, "_new", []);
  236. smalltalk.send(smalltalk.send(self, "_allClasses", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(categories, "_includes_", [smalltalk.send(each, "_category", [])]), "_ifFalse_", [(function(){return smalltalk.send(categories, "_add_", [smalltalk.send(each, "_category", [])]);})]);})]);
  237. return smalltalk.send(categories, "_sort", []);
  238. return self;}
  239. }),
  240. smalltalk.TestRunner);
  241. smalltalk.addMethod(
  242. '_classes',
  243. smalltalk.method({
  244. selector: 'classes',
  245. fn: function (){
  246. var self=this;
  247. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_allClasses", []), "_select_", [(function(each){return smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_includes_", [smalltalk.send(each, "_category", [])]);})]), "_sort_", [(function(a, b){return smalltalk.send(smalltalk.send(a, "_name", []), "__gt", [smalltalk.send(b, "_name", [])]);})]);
  248. return self;}
  249. }),
  250. smalltalk.TestRunner);
  251. smalltalk.addMethod(
  252. '_selectedCategories',
  253. smalltalk.method({
  254. selector: 'selectedCategories',
  255. fn: function (){
  256. var self=this;
  257. return smalltalk.send(self['@selectedCategories'], "_ifNil_", [(function(){return self['@selectedCategories']=smalltalk.send(smalltalk.Array, "_new", []);})]);
  258. return self;}
  259. }),
  260. smalltalk.TestRunner);
  261. smalltalk.addMethod(
  262. '_allClasses',
  263. smalltalk.method({
  264. selector: 'allClasses',
  265. fn: function (){
  266. var self=this;
  267. return smalltalk.send(smalltalk.TestCase, "_allSubclasses", []);
  268. return self;}
  269. }),
  270. smalltalk.TestRunner);
  271. smalltalk.addMethod(
  272. '_selectedClasses',
  273. smalltalk.method({
  274. selector: 'selectedClasses',
  275. fn: function (){
  276. var self=this;
  277. return smalltalk.send(self['@selectedClasses'], "_ifNil_", [(function(){return self['@selectedClasses']=smalltalk.send(smalltalk.Array, "_new", []);})]);
  278. return self;}
  279. }),
  280. smalltalk.TestRunner);
  281. smalltalk.addMethod(
  282. '_progressBar',
  283. smalltalk.method({
  284. selector: 'progressBar',
  285. fn: function (){
  286. var self=this;
  287. return smalltalk.send(self['@progressBar'], "_ifNil_", [(function(){return self['@progressBar']=smalltalk.send(smalltalk.ProgressBar, "_new", []);})]);
  288. return self;}
  289. }),
  290. smalltalk.TestRunner);
  291. smalltalk.addMethod(
  292. '_selectedMethods',
  293. smalltalk.method({
  294. selector: 'selectedMethods',
  295. fn: function (){
  296. var self=this;
  297. return smalltalk.send(self['@selectedMethods'], "_ifNil_", [(function(){return smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_collect_", [(function(each){return smalltalk.send(smalltalk.send(smalltalk.send(each, "_methodDictionary", []), "_keys", []), "_select_", [(function(key){return smalltalk.send(key, "_beginsWith_", ["test"]);})]);})]);})]);
  298. return self;}
  299. }),
  300. smalltalk.TestRunner);
  301. smalltalk.addMethod(
  302. '_statusInfo',
  303. smalltalk.method({
  304. selector: 'statusInfo',
  305. fn: function (){
  306. var self=this;
  307. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printTotal", []), "__comma", [smalltalk.send(self, "_printPasses", [])]), "__comma", [smalltalk.send(self, "_printErrors", [])]), "__comma", [smalltalk.send(self, "_printFailures", [])]);
  308. return self;}
  309. }),
  310. smalltalk.TestRunner);
  311. smalltalk.addMethod(
  312. '_result',
  313. smalltalk.method({
  314. selector: 'result',
  315. fn: function (){
  316. var self=this;
  317. return self['@result'];
  318. return self;}
  319. }),
  320. smalltalk.TestRunner);
  321. smalltalk.addMethod(
  322. '_failedMethods',
  323. smalltalk.method({
  324. selector: 'failedMethods',
  325. fn: function (){
  326. var self=this;
  327. smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_collect_", [(function(each){return (function($rec){smalltalk.send($rec, "_class_", ["failures"]);return smalltalk.send($rec, "_with_", [each]);})(smalltalk.send(html, "_li", []));})]);
  328. return self;}
  329. }),
  330. smalltalk.TestRunner);
  331. smalltalk.addMethod(
  332. '_selectAllCategories',
  333. smalltalk.method({
  334. selector: 'selectAllCategories',
  335. fn: function (){
  336. var self=this;
  337. smalltalk.send(smalltalk.send(self, "_categories", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self['@selectedCategories'], "_includes_", [each]), "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_add_", [each]);})]);})]);
  338. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  339. return self;}
  340. }),
  341. smalltalk.TestRunner);
  342. smalltalk.addMethod(
  343. '_toggleCategory_',
  344. smalltalk.method({
  345. selector: 'toggleCategory:',
  346. fn: function (aCategory){
  347. var self=this;
  348. smalltalk.send(smalltalk.send(self, "_isSelectedCategory_", [aCategory]), "_ifFalse_ifTrue_", [(function(){return smalltalk.send(self['@selectedCategories'], "_add_", [aCategory]);}), (function(){return smalltalk.send(self['@selectedCategories'], "_remove_", [aCategory]);})]);
  349. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  350. return self;}
  351. }),
  352. smalltalk.TestRunner);
  353. smalltalk.addMethod(
  354. '_toggleClass_',
  355. smalltalk.method({
  356. selector: 'toggleClass:',
  357. fn: function (aClass){
  358. var self=this;
  359. smalltalk.send(smalltalk.send(self, "_isSelectedClass_", [aClass]), "_ifFalse_ifTrue_", [(function(){return smalltalk.send(self['@selectedClasses'], "_add_", [aClass]);}), (function(){return smalltalk.send(self['@selectedClasses'], "_remove_", [aClass]);})]);
  360. smalltalk.send(self, "_updateClassesList", []);
  361. return self;}
  362. }),
  363. smalltalk.TestRunner);
  364. smalltalk.addMethod(
  365. '_selectAllClasses',
  366. smalltalk.method({
  367. selector: 'selectAllClasses',
  368. fn: function (){
  369. var self=this;
  370. smalltalk.send(smalltalk.send(self, "_classes", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self['@selectedClasses'], "_includes_", [each]), "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_add_", [each]);})]);})]);
  371. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  372. return self;}
  373. }),
  374. smalltalk.TestRunner);
  375. smalltalk.addMethod(
  376. '_run_',
  377. smalltalk.method({
  378. selector: 'run:',
  379. fn: function (aCollection){
  380. var self=this;
  381. self['@result']=smalltalk.send(smalltalk.TestResult, "_new", []);
  382. (function($rec){smalltalk.send($rec, "_updateStatusDiv", []);return smalltalk.send($rec, "_updateMethodsList", []);})(self);
  383. smalltalk.send(smalltalk.send(self, "_progressBar", []), "_updatePercent_", [(0)]);
  384. smalltalk.send(self['@result'], "_total_", [smalltalk.send(aCollection, "_inject_into_", [(0), (function(acc, each){return smalltalk.send(acc, "__plus", [smalltalk.send(smalltalk.send(each, "_methods", []), "_size", [])]);})])]);
  385. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send((function(){smalltalk.send(each, "_runCaseFor_", [self['@result']]);smalltalk.send(smalltalk.send(self, "_progressBar", []), "_updatePercent_", [smalltalk.send(smalltalk.send(smalltalk.send(self['@result'], "_runs", []), "__slash", [smalltalk.send(self['@result'], "_total", [])]), "__star", [(100)])]);smalltalk.send(self, "_updateStatusDiv", []);return smalltalk.send(self, "_updateMethodsList", []);}), "_valueWithTimeout_", [(100)]);})]);
  386. return self;}
  387. }),
  388. smalltalk.TestRunner);
  389. smalltalk.addMethod(
  390. '_initialize',
  391. smalltalk.method({
  392. selector: 'initialize',
  393. fn: function (){
  394. var self=this;
  395. smalltalk.send(self, "_initialize", [], smalltalk.TabWidget);
  396. self['@result']=smalltalk.send(smalltalk.TestResult, "_new", []);
  397. return self;}
  398. }),
  399. smalltalk.TestRunner);
  400. smalltalk.addMethod(
  401. '_printErrors',
  402. smalltalk.method({
  403. selector: 'printErrors',
  404. fn: function (){
  405. var self=this;
  406. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_errors", []), "_size", []), "_asString", []), "__comma", [unescape("%20errors%2C%20")]);
  407. return self;}
  408. }),
  409. smalltalk.TestRunner);
  410. smalltalk.addMethod(
  411. '_printFailures',
  412. smalltalk.method({
  413. selector: 'printFailures',
  414. fn: function (){
  415. var self=this;
  416. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_size", []), "_asString", []), "__comma", [" failures"]);
  417. return self;}
  418. }),
  419. smalltalk.TestRunner);
  420. smalltalk.addMethod(
  421. '_printPasses',
  422. smalltalk.method({
  423. selector: 'printPasses',
  424. fn: function (){
  425. var self=this;
  426. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_total", []), "__minus", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_errors", []), "_size", []), "__plus", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_size", [])])]), "_asString", []), "__comma", [unescape("%20passes%2C%20")]);
  427. return self;}
  428. }),
  429. smalltalk.TestRunner);
  430. smalltalk.addMethod(
  431. '_printTotal',
  432. smalltalk.method({
  433. selector: 'printTotal',
  434. fn: function (){
  435. var self=this;
  436. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_total", []), "_asString", []), "__comma", [unescape("%20runs%2C%20")]);
  437. return self;}
  438. }),
  439. smalltalk.TestRunner);
  440. smalltalk.addMethod(
  441. '_renderBoxOn_',
  442. smalltalk.method({
  443. selector: 'renderBoxOn:',
  444. fn: function (html){
  445. var self=this;
  446. (function($rec){smalltalk.send($rec, "_renderCategoriesOn_", [html]);smalltalk.send($rec, "_renderClassesOn_", [html]);return smalltalk.send($rec, "_renderResultsOn_", [html]);})(self);
  447. return self;}
  448. }),
  449. smalltalk.TestRunner);
  450. smalltalk.addMethod(
  451. '_renderButtonsOn_',
  452. smalltalk.method({
  453. selector: 'renderButtonsOn:',
  454. fn: function (html){
  455. var self=this;
  456. (function($rec){smalltalk.send($rec, "_with_", ["Run selected"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_run_", [smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_collect_", [(function(each){return smalltalk.send(each, "_new", []);})])]);})]);})(smalltalk.send(html, "_button", []));
  457. return self;}
  458. }),
  459. smalltalk.TestRunner);
  460. smalltalk.addMethod(
  461. '_renderCategoriesOn_',
  462. smalltalk.method({
  463. selector: 'renderCategoriesOn:',
  464. fn: function (html){
  465. var self=this;
  466. self['@categoriesList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit categories"]);
  467. smalltalk.send(self, "_updateCategoriesList", []);
  468. return self;}
  469. }),
  470. smalltalk.TestRunner);
  471. smalltalk.addMethod(
  472. '_renderClassesOn_',
  473. smalltalk.method({
  474. selector: 'renderClassesOn:',
  475. fn: function (html){
  476. var self=this;
  477. self['@classesList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit classes"]);
  478. smalltalk.send(self, "_updateClassesList", []);
  479. return self;}
  480. }),
  481. smalltalk.TestRunner);
  482. smalltalk.addMethod(
  483. '_renderResultsOn_',
  484. smalltalk.method({
  485. selector: 'renderResultsOn:',
  486. fn: function (html){
  487. var self=this;
  488. self['@statusDiv']=smalltalk.send(html, "_div", []);
  489. smalltalk.send(html, "_with_", [smalltalk.send(self, "_progressBar", [])]);
  490. self['@methodsList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit methods"]);
  491. smalltalk.send(self, "_updateMethodsList", []);
  492. smalltalk.send(self, "_updateStatusDiv", []);
  493. return self;}
  494. }),
  495. smalltalk.TestRunner);
  496. smalltalk.addMethod(
  497. '_renderFailuresOn_',
  498. smalltalk.method({
  499. selector: 'renderFailuresOn:',
  500. fn: function (html){
  501. var self=this;
  502. smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_do_", [(function(each){return (function($rec){smalltalk.send($rec, "_class_", ["failures"]);return smalltalk.send($rec, "_with_", [each]);})(smalltalk.send(html, "_li", []));})]);
  503. return self;}
  504. }),
  505. smalltalk.TestRunner);
  506. smalltalk.addMethod(
  507. '_renderErrorsOn_',
  508. smalltalk.method({
  509. selector: 'renderErrorsOn:',
  510. fn: function (html){
  511. var self=this;
  512. smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_errors", []), "_do_", [(function(each){return (function($rec){smalltalk.send($rec, "_class_", ["errors"]);return smalltalk.send($rec, "_with_", [each]);})(smalltalk.send(html, "_li", []));})]);
  513. return self;}
  514. }),
  515. smalltalk.TestRunner);
  516. smalltalk.addMethod(
  517. '_canBeClosed',
  518. smalltalk.method({
  519. selector: 'canBeClosed',
  520. fn: function (){
  521. var self=this;
  522. return true;
  523. return self;}
  524. }),
  525. smalltalk.TestRunner);
  526. smalltalk.addMethod(
  527. '_isSelectedClass_',
  528. smalltalk.method({
  529. selector: 'isSelectedClass:',
  530. fn: function (aClass){
  531. var self=this;
  532. return smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_includes_", [aClass]);
  533. return self;}
  534. }),
  535. smalltalk.TestRunner);
  536. smalltalk.addMethod(
  537. '_isSelectedCategory_',
  538. smalltalk.method({
  539. selector: 'isSelectedCategory:',
  540. fn: function (aCategory){
  541. var self=this;
  542. return smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_includes_", [aCategory]);
  543. return self;}
  544. }),
  545. smalltalk.TestRunner);
  546. smalltalk.addMethod(
  547. '_updateCategoriesList',
  548. smalltalk.method({
  549. selector: 'updateCategoriesList',
  550. fn: function (){
  551. var self=this;
  552. smalltalk.send(self['@categoriesList'], "_contents_", [(function(html){(function($rec){smalltalk.send($rec, "_class_", ["all"]);smalltalk.send($rec, "_with_", ["All"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectAllCategories", []);})]);})(smalltalk.send(html, "_li", []));return smalltalk.send(smalltalk.send(self, "_categories", []), "_do_", [(function(each){var li=nil;
  553. li=smalltalk.send(html, "_li", []);smalltalk.send(smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_includes_", [each]), "_ifTrue_", [(function(){return smalltalk.send(li, "_class_", ["selected"]);})]);return (function($rec){smalltalk.send($rec, "_with_", [each]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_toggleCategory_", [each]);})]);})(li);})]);})]);
  554. return self;}
  555. }),
  556. smalltalk.TestRunner);
  557. smalltalk.addMethod(
  558. '_updateClassesList',
  559. smalltalk.method({
  560. selector: 'updateClassesList',
  561. fn: function (){
  562. var self=this;
  563. smalltalk.send(self['@classesList'], "_contents_", [(function(html){smalltalk.send(smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_isEmpty", []), "_ifFalse_", [(function(){return (function($rec){smalltalk.send($rec, "_class_", ["all"]);smalltalk.send($rec, "_with_", ["All"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectAllClasses", []);})]);})(smalltalk.send(html, "_li", []));})]);return smalltalk.send(smalltalk.send(self, "_classes", []), "_do_", [(function(each){var li=nil;
  564. li=smalltalk.send(html, "_li", []);smalltalk.send(smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_includes_", [each]), "_ifTrue_", [(function(){return smalltalk.send(li, "_class_", ["selected"]);})]);return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_toggleClass_", [each]);})]);})(li);})]);})]);
  565. return self;}
  566. }),
  567. smalltalk.TestRunner);
  568. smalltalk.addMethod(
  569. '_updateMethodsList',
  570. smalltalk.method({
  571. selector: 'updateMethodsList',
  572. fn: function (){
  573. var self=this;
  574. smalltalk.send(self['@methodsList'], "_contents_", [(function(html){smalltalk.send(self, "_renderFailuresOn_", [html]);return smalltalk.send(self, "_renderErrorsOn_", [html]);})]);
  575. return self;}
  576. }),
  577. smalltalk.TestRunner);
  578. smalltalk.addMethod(
  579. '_updateStatusDiv',
  580. smalltalk.method({
  581. selector: 'updateStatusDiv',
  582. fn: function (){
  583. var self=this;
  584. smalltalk.send(self['@statusDiv'], "_class_", [smalltalk.send("sunit status ", "__comma", [smalltalk.send(self['@result'], "_status", [])])]);
  585. smalltalk.send(self['@statusDiv'], "_contents_", [(function(html){return smalltalk.send(smalltalk.send(html, "_span", []), "_with_", [smalltalk.send(self, "_statusInfo", [])]);})]);
  586. return self;}
  587. }),
  588. smalltalk.TestRunner);
  589. smalltalk.addClass('TestResult', smalltalk.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  590. smalltalk.addMethod(
  591. '_timestamp',
  592. smalltalk.method({
  593. selector: 'timestamp',
  594. fn: function (){
  595. var self=this;
  596. return self['@timestamp'];
  597. return self;}
  598. }),
  599. smalltalk.TestResult);
  600. smalltalk.addMethod(
  601. '_errors',
  602. smalltalk.method({
  603. selector: 'errors',
  604. fn: function (){
  605. var self=this;
  606. return self['@errors'];
  607. return self;}
  608. }),
  609. smalltalk.TestResult);
  610. smalltalk.addMethod(
  611. '_failures',
  612. smalltalk.method({
  613. selector: 'failures',
  614. fn: function (){
  615. var self=this;
  616. return self['@failures'];
  617. return self;}
  618. }),
  619. smalltalk.TestResult);
  620. smalltalk.addMethod(
  621. '_total',
  622. smalltalk.method({
  623. selector: 'total',
  624. fn: function (){
  625. var self=this;
  626. return self['@total'];
  627. return self;}
  628. }),
  629. smalltalk.TestResult);
  630. smalltalk.addMethod(
  631. '_total_',
  632. smalltalk.method({
  633. selector: 'total:',
  634. fn: function (aNumber){
  635. var self=this;
  636. self['@total']=aNumber;
  637. return self;}
  638. }),
  639. smalltalk.TestResult);
  640. smalltalk.addMethod(
  641. '_addError_',
  642. smalltalk.method({
  643. selector: 'addError:',
  644. fn: function (anError){
  645. var self=this;
  646. smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
  647. return self;}
  648. }),
  649. smalltalk.TestResult);
  650. smalltalk.addMethod(
  651. '_addFailure_',
  652. smalltalk.method({
  653. selector: 'addFailure:',
  654. fn: function (aFailure){
  655. var self=this;
  656. smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
  657. return self;}
  658. }),
  659. smalltalk.TestResult);
  660. smalltalk.addMethod(
  661. '_runs',
  662. smalltalk.method({
  663. selector: 'runs',
  664. fn: function (){
  665. var self=this;
  666. return self['@runs'];
  667. return self;}
  668. }),
  669. smalltalk.TestResult);
  670. smalltalk.addMethod(
  671. '_increaseRuns',
  672. smalltalk.method({
  673. selector: 'increaseRuns',
  674. fn: function (){
  675. var self=this;
  676. self['@runs']=smalltalk.send(self['@runs'], "__plus", [(1)]);
  677. return self;}
  678. }),
  679. smalltalk.TestResult);
  680. smalltalk.addMethod(
  681. '_status',
  682. smalltalk.method({
  683. selector: 'status',
  684. fn: function (){
  685. var self=this;
  686. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_errors", []), "_isEmpty", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_failures", []), "_isEmpty", []), "_ifTrue_ifFalse_", [(function(){return "success";}), (function(){return "failure";})]);}), (function(){return "error";})]);
  687. return self;}
  688. }),
  689. smalltalk.TestResult);
  690. smalltalk.addMethod(
  691. '_initialize',
  692. smalltalk.method({
  693. selector: 'initialize',
  694. fn: function (){
  695. var self=this;
  696. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  697. self['@timestamp']=smalltalk.send(smalltalk.Date, "_now", []);
  698. self['@runs']=(0);
  699. self['@errors']=smalltalk.send(smalltalk.Array, "_new", []);
  700. self['@failures']=smalltalk.send(smalltalk.Array, "_new", []);
  701. self['@total']=(0);
  702. return self;}
  703. }),
  704. smalltalk.TestResult);
  705. smalltalk.addClass('ExampleTest2', smalltalk.TestCase, [], 'SUnit');
  706. smalltalk.addMethod(
  707. '_testPasses',
  708. smalltalk.method({
  709. selector: 'testPasses',
  710. fn: function (){
  711. var self=this;
  712. smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
  713. return self;}
  714. }),
  715. smalltalk.ExampleTest2);
  716. smalltalk.addClass('ExampleTest3', smalltalk.TestCase, [], 'SUnit');
  717. smalltalk.addMethod(
  718. '_testPasses',
  719. smalltalk.method({
  720. selector: 'testPasses',
  721. fn: function (){
  722. var self=this;
  723. smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
  724. return self;}
  725. }),
  726. smalltalk.ExampleTest3);