2
0

SUnit.deploy.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  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(self, "_class", []), "_name", []), "__comma", [unescape("%3E%3E")]), "__comma", [each])]);})]);}), "_on_do_", [smalltalk.Error, (function(ex){return smalltalk.send(aResult, "_addError_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_name", []), "__comma", [unescape("%3E%3E")]), "__comma", [each])]);})]);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(aBoolean, "_ifFalse_", [(function(){return smalltalk.send(self, "_signalFailure_", ["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_", [smalltalk.send(expected, "__eq", [actual])]);
  119. return self;}
  120. }),
  121. smalltalk.TestCase);
  122. smalltalk.addClass('ExampleTest', smalltalk.TestCase, ['test'], 'SUnit');
  123. smalltalk.addMethod(
  124. '_testFailure',
  125. smalltalk.method({
  126. selector: 'testFailure',
  127. fn: function (){
  128. var self=this;
  129. smalltalk.send(self, "_deny_", [true]);
  130. return self;}
  131. }),
  132. smalltalk.ExampleTest);
  133. smalltalk.addMethod(
  134. '_testPasses',
  135. smalltalk.method({
  136. selector: 'testPasses',
  137. fn: function (){
  138. var self=this;
  139. smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
  140. return self;}
  141. }),
  142. smalltalk.ExampleTest);
  143. smalltalk.addMethod(
  144. '_testError',
  145. smalltalk.method({
  146. selector: 'testError',
  147. fn: function (){
  148. var self=this;
  149. smalltalk.send(self, "_assert_", [smalltalk.send((1), "_foo", [])]);
  150. return self;}
  151. }),
  152. smalltalk.ExampleTest);
  153. smalltalk.addClass('ProgressBar', smalltalk.TabWidget, ['percent', 'progressDiv', 'div'], 'SUnit');
  154. smalltalk.addMethod(
  155. '_percent',
  156. smalltalk.method({
  157. selector: 'percent',
  158. fn: function (){
  159. var self=this;
  160. return smalltalk.send(self['@percent'], "_ifNil_", [(function(){return (0);})]);
  161. return self;}
  162. }),
  163. smalltalk.ProgressBar);
  164. smalltalk.addMethod(
  165. '_percent_',
  166. smalltalk.method({
  167. selector: 'percent:',
  168. fn: function (aNumber){
  169. var self=this;
  170. self['@percent']=aNumber;
  171. return self;}
  172. }),
  173. smalltalk.ProgressBar);
  174. smalltalk.addMethod(
  175. '_renderOn_',
  176. smalltalk.method({
  177. selector: 'renderOn:',
  178. fn: function (html){
  179. var self=this;
  180. self['@div']=(function($rec){smalltalk.send($rec, "_class_", ["progress_bar"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(html, "_div", []));
  181. smalltalk.send(self, "_renderProgressBar", []);
  182. return self;}
  183. }),
  184. smalltalk.ProgressBar);
  185. smalltalk.addMethod(
  186. '_updatePercent_',
  187. smalltalk.method({
  188. selector: 'updatePercent:',
  189. fn: function (aNumber){
  190. var self=this;
  191. smalltalk.send(self, "_percent_", [aNumber]);
  192. smalltalk.send(self, "_renderProgressBar", []);
  193. return self;}
  194. }),
  195. smalltalk.ProgressBar);
  196. smalltalk.addMethod(
  197. '_renderProgressBar',
  198. smalltalk.method({
  199. selector: 'renderProgressBar',
  200. fn: function (){
  201. var self=this;
  202. 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", []));})]);
  203. return self;}
  204. }),
  205. smalltalk.ProgressBar);
  206. smalltalk.addClass('TestFailure', smalltalk.Error, [], 'SUnit');
  207. smalltalk.addClass('TestRunner', smalltalk.TabWidget, ['selectedCategories', 'categoriesList', 'selectedClasses', 'classesList', 'selectedMethods', 'progressBar', 'methodsList', 'result', 'statusDiv'], 'SUnit');
  208. smalltalk.addMethod(
  209. '_label',
  210. smalltalk.method({
  211. selector: 'label',
  212. fn: function (){
  213. var self=this;
  214. return unescape("%5BTest%20runner%5D");
  215. return self;}
  216. }),
  217. smalltalk.TestRunner);
  218. smalltalk.addMethod(
  219. '_categories',
  220. smalltalk.method({
  221. selector: 'categories',
  222. fn: function (){
  223. var self=this;
  224. var categories=nil;
  225. categories=smalltalk.send(smalltalk.Array, "_new", []);
  226. 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", [])]);})]);})]);
  227. return smalltalk.send(categories, "_sort", []);
  228. return self;}
  229. }),
  230. smalltalk.TestRunner);
  231. smalltalk.addMethod(
  232. '_classes',
  233. smalltalk.method({
  234. selector: 'classes',
  235. fn: function (){
  236. var self=this;
  237. 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", [])]);})]);
  238. return self;}
  239. }),
  240. smalltalk.TestRunner);
  241. smalltalk.addMethod(
  242. '_selectedCategories',
  243. smalltalk.method({
  244. selector: 'selectedCategories',
  245. fn: function (){
  246. var self=this;
  247. return smalltalk.send(self['@selectedCategories'], "_ifNil_", [(function(){return self['@selectedCategories']=smalltalk.send(smalltalk.Array, "_new", []);})]);
  248. return self;}
  249. }),
  250. smalltalk.TestRunner);
  251. smalltalk.addMethod(
  252. '_allClasses',
  253. smalltalk.method({
  254. selector: 'allClasses',
  255. fn: function (){
  256. var self=this;
  257. return smalltalk.send(smalltalk.TestCase, "_allSubclasses", []);
  258. return self;}
  259. }),
  260. smalltalk.TestRunner);
  261. smalltalk.addMethod(
  262. '_selectedClasses',
  263. smalltalk.method({
  264. selector: 'selectedClasses',
  265. fn: function (){
  266. var self=this;
  267. return smalltalk.send(self['@selectedClasses'], "_ifNil_", [(function(){return self['@selectedClasses']=smalltalk.send(smalltalk.Array, "_new", []);})]);
  268. return self;}
  269. }),
  270. smalltalk.TestRunner);
  271. smalltalk.addMethod(
  272. '_progressBar',
  273. smalltalk.method({
  274. selector: 'progressBar',
  275. fn: function (){
  276. var self=this;
  277. return smalltalk.send(self['@progressBar'], "_ifNil_", [(function(){return self['@progressBar']=smalltalk.send(smalltalk.ProgressBar, "_new", []);})]);
  278. return self;}
  279. }),
  280. smalltalk.TestRunner);
  281. smalltalk.addMethod(
  282. '_selectedMethods',
  283. smalltalk.method({
  284. selector: 'selectedMethods',
  285. fn: function (){
  286. var self=this;
  287. 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"]);})]);})]);})]);
  288. return self;}
  289. }),
  290. smalltalk.TestRunner);
  291. smalltalk.addMethod(
  292. '_statusInfo',
  293. smalltalk.method({
  294. selector: 'statusInfo',
  295. fn: function (){
  296. var self=this;
  297. 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", [])]);
  298. return self;}
  299. }),
  300. smalltalk.TestRunner);
  301. smalltalk.addMethod(
  302. '_result',
  303. smalltalk.method({
  304. selector: 'result',
  305. fn: function (){
  306. var self=this;
  307. return self['@result'];
  308. return self;}
  309. }),
  310. smalltalk.TestRunner);
  311. smalltalk.addMethod(
  312. '_failedMethods',
  313. smalltalk.method({
  314. selector: 'failedMethods',
  315. fn: function (){
  316. var self=this;
  317. 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", []));})]);
  318. return self;}
  319. }),
  320. smalltalk.TestRunner);
  321. smalltalk.addMethod(
  322. '_selectAllCategories',
  323. smalltalk.method({
  324. selector: 'selectAllCategories',
  325. fn: function (){
  326. var self=this;
  327. 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]);})]);})]);
  328. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  329. return self;}
  330. }),
  331. smalltalk.TestRunner);
  332. smalltalk.addMethod(
  333. '_toggleCategory_',
  334. smalltalk.method({
  335. selector: 'toggleCategory:',
  336. fn: function (aCategory){
  337. var self=this;
  338. 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]);})]);
  339. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  340. return self;}
  341. }),
  342. smalltalk.TestRunner);
  343. smalltalk.addMethod(
  344. '_toggleClass_',
  345. smalltalk.method({
  346. selector: 'toggleClass:',
  347. fn: function (aClass){
  348. var self=this;
  349. 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]);})]);
  350. smalltalk.send(self, "_updateClassesList", []);
  351. return self;}
  352. }),
  353. smalltalk.TestRunner);
  354. smalltalk.addMethod(
  355. '_selectAllClasses',
  356. smalltalk.method({
  357. selector: 'selectAllClasses',
  358. fn: function (){
  359. var self=this;
  360. 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]);})]);})]);
  361. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  362. return self;}
  363. }),
  364. smalltalk.TestRunner);
  365. smalltalk.addMethod(
  366. '_run_',
  367. smalltalk.method({
  368. selector: 'run:',
  369. fn: function (aCollection){
  370. var self=this;
  371. self['@result']=smalltalk.send(smalltalk.TestResult, "_new", []);
  372. (function($rec){smalltalk.send($rec, "_updateStatusDiv", []);return smalltalk.send($rec, "_updateMethodsList", []);})(self);
  373. smalltalk.send(smalltalk.send(self, "_progressBar", []), "_updatePercent_", [(0)]);
  374. 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", [])]);})])]);
  375. 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)]);})]);
  376. return self;}
  377. }),
  378. smalltalk.TestRunner);
  379. smalltalk.addMethod(
  380. '_initialize',
  381. smalltalk.method({
  382. selector: 'initialize',
  383. fn: function (){
  384. var self=this;
  385. smalltalk.send(self, "_initialize", [], smalltalk.TabWidget);
  386. self['@result']=smalltalk.send(smalltalk.TestResult, "_new", []);
  387. return self;}
  388. }),
  389. smalltalk.TestRunner);
  390. smalltalk.addMethod(
  391. '_printErrors',
  392. smalltalk.method({
  393. selector: 'printErrors',
  394. fn: function (){
  395. var self=this;
  396. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_errors", []), "_size", []), "_asString", []), "__comma", [unescape("%20errors%2C%20")]);
  397. return self;}
  398. }),
  399. smalltalk.TestRunner);
  400. smalltalk.addMethod(
  401. '_printFailures',
  402. smalltalk.method({
  403. selector: 'printFailures',
  404. fn: function (){
  405. var self=this;
  406. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_size", []), "_asString", []), "__comma", [" failures"]);
  407. return self;}
  408. }),
  409. smalltalk.TestRunner);
  410. smalltalk.addMethod(
  411. '_printPasses',
  412. smalltalk.method({
  413. selector: 'printPasses',
  414. fn: function (){
  415. var self=this;
  416. 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")]);
  417. return self;}
  418. }),
  419. smalltalk.TestRunner);
  420. smalltalk.addMethod(
  421. '_printTotal',
  422. smalltalk.method({
  423. selector: 'printTotal',
  424. fn: function (){
  425. var self=this;
  426. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_total", []), "_asString", []), "__comma", [unescape("%20runs%2C%20")]);
  427. return self;}
  428. }),
  429. smalltalk.TestRunner);
  430. smalltalk.addMethod(
  431. '_renderBoxOn_',
  432. smalltalk.method({
  433. selector: 'renderBoxOn:',
  434. fn: function (html){
  435. var self=this;
  436. (function($rec){smalltalk.send($rec, "_renderCategoriesOn_", [html]);smalltalk.send($rec, "_renderClassesOn_", [html]);return smalltalk.send($rec, "_renderResultsOn_", [html]);})(self);
  437. return self;}
  438. }),
  439. smalltalk.TestRunner);
  440. smalltalk.addMethod(
  441. '_renderButtonsOn_',
  442. smalltalk.method({
  443. selector: 'renderButtonsOn:',
  444. fn: function (html){
  445. var self=this;
  446. (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", []));
  447. return self;}
  448. }),
  449. smalltalk.TestRunner);
  450. smalltalk.addMethod(
  451. '_renderCategoriesOn_',
  452. smalltalk.method({
  453. selector: 'renderCategoriesOn:',
  454. fn: function (html){
  455. var self=this;
  456. self['@categoriesList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit categories"]);
  457. smalltalk.send(self, "_updateCategoriesList", []);
  458. return self;}
  459. }),
  460. smalltalk.TestRunner);
  461. smalltalk.addMethod(
  462. '_renderClassesOn_',
  463. smalltalk.method({
  464. selector: 'renderClassesOn:',
  465. fn: function (html){
  466. var self=this;
  467. self['@classesList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit classes"]);
  468. smalltalk.send(self, "_updateClassesList", []);
  469. return self;}
  470. }),
  471. smalltalk.TestRunner);
  472. smalltalk.addMethod(
  473. '_renderResultsOn_',
  474. smalltalk.method({
  475. selector: 'renderResultsOn:',
  476. fn: function (html){
  477. var self=this;
  478. self['@statusDiv']=smalltalk.send(html, "_div", []);
  479. smalltalk.send(html, "_with_", [smalltalk.send(self, "_progressBar", [])]);
  480. self['@methodsList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit methods"]);
  481. smalltalk.send(self, "_updateMethodsList", []);
  482. smalltalk.send(self, "_updateStatusDiv", []);
  483. return self;}
  484. }),
  485. smalltalk.TestRunner);
  486. smalltalk.addMethod(
  487. '_renderFailuresOn_',
  488. smalltalk.method({
  489. selector: 'renderFailuresOn:',
  490. fn: function (html){
  491. var self=this;
  492. 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", []));})]);
  493. return self;}
  494. }),
  495. smalltalk.TestRunner);
  496. smalltalk.addMethod(
  497. '_renderErrorsOn_',
  498. smalltalk.method({
  499. selector: 'renderErrorsOn:',
  500. fn: function (html){
  501. var self=this;
  502. 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", []));})]);
  503. return self;}
  504. }),
  505. smalltalk.TestRunner);
  506. smalltalk.addMethod(
  507. '_canBeClosed',
  508. smalltalk.method({
  509. selector: 'canBeClosed',
  510. fn: function (){
  511. var self=this;
  512. return true;
  513. return self;}
  514. }),
  515. smalltalk.TestRunner);
  516. smalltalk.addMethod(
  517. '_isSelectedClass_',
  518. smalltalk.method({
  519. selector: 'isSelectedClass:',
  520. fn: function (aClass){
  521. var self=this;
  522. return smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_includes_", [aClass]);
  523. return self;}
  524. }),
  525. smalltalk.TestRunner);
  526. smalltalk.addMethod(
  527. '_isSelectedCategory_',
  528. smalltalk.method({
  529. selector: 'isSelectedCategory:',
  530. fn: function (aCategory){
  531. var self=this;
  532. return smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_includes_", [aCategory]);
  533. return self;}
  534. }),
  535. smalltalk.TestRunner);
  536. smalltalk.addMethod(
  537. '_updateCategoriesList',
  538. smalltalk.method({
  539. selector: 'updateCategoriesList',
  540. fn: function (){
  541. var self=this;
  542. 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;
  543. 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);})]);})]);
  544. return self;}
  545. }),
  546. smalltalk.TestRunner);
  547. smalltalk.addMethod(
  548. '_updateClassesList',
  549. smalltalk.method({
  550. selector: 'updateClassesList',
  551. fn: function (){
  552. var self=this;
  553. 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;
  554. 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);})]);})]);
  555. return self;}
  556. }),
  557. smalltalk.TestRunner);
  558. smalltalk.addMethod(
  559. '_updateMethodsList',
  560. smalltalk.method({
  561. selector: 'updateMethodsList',
  562. fn: function (){
  563. var self=this;
  564. smalltalk.send(self['@methodsList'], "_contents_", [(function(html){smalltalk.send(self, "_renderFailuresOn_", [html]);return smalltalk.send(self, "_renderErrorsOn_", [html]);})]);
  565. return self;}
  566. }),
  567. smalltalk.TestRunner);
  568. smalltalk.addMethod(
  569. '_updateStatusDiv',
  570. smalltalk.method({
  571. selector: 'updateStatusDiv',
  572. fn: function (){
  573. var self=this;
  574. smalltalk.send(self['@statusDiv'], "_class_", [smalltalk.send("sunit status ", "__comma", [smalltalk.send(self['@result'], "_status", [])])]);
  575. smalltalk.send(self['@statusDiv'], "_contents_", [(function(html){return smalltalk.send(smalltalk.send(html, "_span", []), "_with_", [smalltalk.send(self, "_statusInfo", [])]);})]);
  576. return self;}
  577. }),
  578. smalltalk.TestRunner);
  579. smalltalk.addClass('TestResult', smalltalk.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  580. smalltalk.addMethod(
  581. '_timestamp',
  582. smalltalk.method({
  583. selector: 'timestamp',
  584. fn: function (){
  585. var self=this;
  586. return self['@timestamp'];
  587. return self;}
  588. }),
  589. smalltalk.TestResult);
  590. smalltalk.addMethod(
  591. '_errors',
  592. smalltalk.method({
  593. selector: 'errors',
  594. fn: function (){
  595. var self=this;
  596. return self['@errors'];
  597. return self;}
  598. }),
  599. smalltalk.TestResult);
  600. smalltalk.addMethod(
  601. '_failures',
  602. smalltalk.method({
  603. selector: 'failures',
  604. fn: function (){
  605. var self=this;
  606. return self['@failures'];
  607. return self;}
  608. }),
  609. smalltalk.TestResult);
  610. smalltalk.addMethod(
  611. '_total',
  612. smalltalk.method({
  613. selector: 'total',
  614. fn: function (){
  615. var self=this;
  616. return self['@total'];
  617. return self;}
  618. }),
  619. smalltalk.TestResult);
  620. smalltalk.addMethod(
  621. '_total_',
  622. smalltalk.method({
  623. selector: 'total:',
  624. fn: function (aNumber){
  625. var self=this;
  626. self['@total']=aNumber;
  627. return self;}
  628. }),
  629. smalltalk.TestResult);
  630. smalltalk.addMethod(
  631. '_addError_',
  632. smalltalk.method({
  633. selector: 'addError:',
  634. fn: function (anError){
  635. var self=this;
  636. smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
  637. return self;}
  638. }),
  639. smalltalk.TestResult);
  640. smalltalk.addMethod(
  641. '_addFailure_',
  642. smalltalk.method({
  643. selector: 'addFailure:',
  644. fn: function (aFailure){
  645. var self=this;
  646. smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
  647. return self;}
  648. }),
  649. smalltalk.TestResult);
  650. smalltalk.addMethod(
  651. '_runs',
  652. smalltalk.method({
  653. selector: 'runs',
  654. fn: function (){
  655. var self=this;
  656. return self['@runs'];
  657. return self;}
  658. }),
  659. smalltalk.TestResult);
  660. smalltalk.addMethod(
  661. '_increaseRuns',
  662. smalltalk.method({
  663. selector: 'increaseRuns',
  664. fn: function (){
  665. var self=this;
  666. self['@runs']=smalltalk.send(self['@runs'], "__plus", [(1)]);
  667. return self;}
  668. }),
  669. smalltalk.TestResult);
  670. smalltalk.addMethod(
  671. '_status',
  672. smalltalk.method({
  673. selector: 'status',
  674. fn: function (){
  675. var self=this;
  676. 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";})]);
  677. return self;}
  678. }),
  679. smalltalk.TestResult);
  680. smalltalk.addMethod(
  681. '_initialize',
  682. smalltalk.method({
  683. selector: 'initialize',
  684. fn: function (){
  685. var self=this;
  686. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  687. self['@timestamp']=smalltalk.send(smalltalk.Date, "_now", []);
  688. self['@runs']=(0);
  689. self['@errors']=smalltalk.send(smalltalk.Array, "_new", []);
  690. self['@failures']=smalltalk.send(smalltalk.Array, "_new", []);
  691. self['@total']=(0);
  692. return self;}
  693. }),
  694. smalltalk.TestResult);
  695. smalltalk.addClass('ExampleTest2', smalltalk.TestCase, [], 'SUnit');
  696. smalltalk.addMethod(
  697. '_testPasses',
  698. smalltalk.method({
  699. selector: 'testPasses',
  700. fn: function (){
  701. var self=this;
  702. smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
  703. return self;}
  704. }),
  705. smalltalk.ExampleTest2);
  706. smalltalk.addClass('ExampleTest3', smalltalk.TestCase, [], 'SUnit');
  707. smalltalk.addMethod(
  708. '_testPasses',
  709. smalltalk.method({
  710. selector: 'testPasses',
  711. fn: function (){
  712. var self=this;
  713. smalltalk.send((100000), "_timesRepeat_", [(function(){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "__plus", [(1)]), "__eq", [(2)])]);})]);
  714. return self;}
  715. }),
  716. smalltalk.ExampleTest3);