SUnit.deploy.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. smalltalk.addPackage('SUnit', {});
  2. smalltalk.addClass('ResultAnnouncement', smalltalk.Object, ['result'], 'SUnit');
  3. smalltalk.addMethod(
  4. "_result",
  5. smalltalk.method({
  6. selector: "result",
  7. fn: function (){
  8. var self=this;
  9. return self["@result"];
  10. }
  11. }),
  12. smalltalk.ResultAnnouncement);
  13. smalltalk.addMethod(
  14. "_result_",
  15. smalltalk.method({
  16. selector: "result:",
  17. fn: function (aTestResult){
  18. var self=this;
  19. self["@result"]=aTestResult;
  20. return self}
  21. }),
  22. smalltalk.ResultAnnouncement);
  23. smalltalk.addClass('RunningTestContext', smalltalk.Object, ['finished', 'testCase', 'result', 'step'], 'SUnit');
  24. smalltalk.addMethod(
  25. "_exception_ifNotAsync_",
  26. smalltalk.method({
  27. selector: "exception:ifNotAsync:",
  28. fn: function (anException,aBlock){
  29. var self=this;
  30. var $1;
  31. $1=smalltalk.send(self["@testCase"],"_isAsync",[]);
  32. if(smalltalk.assert($1)){
  33. self["@step"]=(function(){
  34. smalltalk.send(self["@testCase"],"_finished",[]);
  35. return smalltalk.send(anException,"_signal",[]);
  36. });
  37. self["@step"];
  38. } else {
  39. smalltalk.send(aBlock,"_value",[]);
  40. };
  41. return self}
  42. }),
  43. smalltalk.RunningTestContext);
  44. smalltalk.addMethod(
  45. "_execute_",
  46. smalltalk.method({
  47. selector: "execute:",
  48. fn: function (aBlock){
  49. var self=this;
  50. var $1,$2;
  51. self["@step"]=aBlock;
  52. smalltalk.send((function(){
  53. return smalltalk.send(self["@step"],"_isNil",[]);
  54. }),"_whileFalse_",[(function(){
  55. smalltalk.send(self["@testCase"],"_context_",[self]);
  56. return smalltalk.send((function(){
  57. return smalltalk.send((function(){
  58. return smalltalk.send((function(){
  59. return smalltalk.send(self["@step"],"_ensure_",[(function(){
  60. smalltalk.send(self["@testCase"],"_context_",[nil]);
  61. self["@step"]=nil;
  62. self["@step"];
  63. $1=smalltalk.send(self["@testCase"],"_isAsync",[]);
  64. if(! smalltalk.assert($1)){
  65. return smalltalk.send(self["@testCase"],"_tearDown",[]);
  66. };
  67. })]);
  68. }),"_on_do_",[(smalltalk.TestFailure || TestFailure),(function(ex){
  69. return smalltalk.send(self,"_exception_ifNotAsync_",[ex,(function(){
  70. return smalltalk.send(self["@result"],"_addFailure_",[self["@testCase"]]);
  71. })]);
  72. })]);
  73. }),"_on_do_",[(smalltalk.Error || Error),(function(ex){
  74. return smalltalk.send(self,"_exception_ifNotAsync_",[ex,(function(){
  75. return smalltalk.send(self["@result"],"_addError_",[self["@testCase"]]);
  76. })]);
  77. })]);
  78. }),"_ensure_",[(function(){
  79. $2=smalltalk.send(self["@testCase"],"_isAsync",[]);
  80. if(! smalltalk.assert($2)){
  81. smalltalk.send(self["@result"],"_increaseRuns",[]);
  82. return smalltalk.send(self["@finished"],"_value",[]);
  83. };
  84. })]);
  85. })]);
  86. return self}
  87. }),
  88. smalltalk.RunningTestContext);
  89. smalltalk.addMethod(
  90. "_finished_",
  91. smalltalk.method({
  92. selector: "finished:",
  93. fn: function (aBlock){
  94. var self=this;
  95. self["@finished"]=aBlock;
  96. return self}
  97. }),
  98. smalltalk.RunningTestContext);
  99. smalltalk.addMethod(
  100. "_result_",
  101. smalltalk.method({
  102. selector: "result:",
  103. fn: function (aTestResult){
  104. var self=this;
  105. self["@result"]=aTestResult;
  106. return self}
  107. }),
  108. smalltalk.RunningTestContext);
  109. smalltalk.addMethod(
  110. "_start",
  111. smalltalk.method({
  112. selector: "start",
  113. fn: function (){
  114. var self=this;
  115. smalltalk.send(self,"_execute_",[(function(){
  116. smalltalk.send(self["@testCase"],"_setUp",[]);
  117. return smalltalk.send(self["@testCase"],"_performTest",[]);
  118. })]);
  119. return self}
  120. }),
  121. smalltalk.RunningTestContext);
  122. smalltalk.addMethod(
  123. "_testCase_",
  124. smalltalk.method({
  125. selector: "testCase:",
  126. fn: function (aTestCase){
  127. var self=this;
  128. self["@testCase"]=aTestCase;
  129. return self}
  130. }),
  131. smalltalk.RunningTestContext);
  132. smalltalk.addMethod(
  133. "_testCase_result_finished_",
  134. smalltalk.method({
  135. selector: "testCase:result:finished:",
  136. fn: function (aTestCase,aTestResult,aBlock){
  137. var self=this;
  138. var $2,$3,$1;
  139. $2=smalltalk.send(self,"_new",[]);
  140. smalltalk.send($2,"_testCase_",[aTestCase]);
  141. smalltalk.send($2,"_result_",[aTestResult]);
  142. smalltalk.send($2,"_finished_",[aBlock]);
  143. $3=smalltalk.send($2,"_yourself",[]);
  144. $1=$3;
  145. return $1;
  146. }
  147. }),
  148. smalltalk.RunningTestContext.klass);
  149. smalltalk.addClass('ErroringTestContext', smalltalk.RunningTestContext, [], 'SUnit');
  150. smalltalk.addMethod(
  151. "_exception_ifNotAsync_",
  152. smalltalk.method({
  153. selector: "exception:ifNotAsync:",
  154. fn: function (anException,aBlock){
  155. var self=this;
  156. smalltalk.send(anException,"_signal",[]);
  157. return self}
  158. }),
  159. smalltalk.ErroringTestContext);
  160. smalltalk.addMethod(
  161. "_testCase_",
  162. smalltalk.method({
  163. selector: "testCase:",
  164. fn: function (aTestCase){
  165. var self=this;
  166. var $1;
  167. $1=smalltalk.send(self,"_testCase_result_finished_",[aTestCase,smalltalk.send((smalltalk.TestResult || TestResult),"_new",[]),(function(){
  168. })]);
  169. return $1;
  170. }
  171. }),
  172. smalltalk.ErroringTestContext.klass);
  173. smalltalk.addClass('TestCase', smalltalk.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  174. smalltalk.addMethod(
  175. "_assert_",
  176. smalltalk.method({
  177. selector: "assert:",
  178. fn: function (aBoolean) {
  179. var self = this;
  180. smalltalk.send(self, "_assert_description_", [aBoolean, "Assertion failed"]);
  181. return self;
  182. }
  183. }),
  184. smalltalk.TestCase);
  185. smalltalk.addMethod(
  186. "_assert_description_",
  187. smalltalk.method({
  188. selector: "assert:description:",
  189. fn: function (aBoolean, aString) {
  190. var self = this;
  191. if (!smalltalk.assert(aBoolean)) {
  192. smalltalk.send(self, "_signalFailure_", [aString]);
  193. }
  194. return self;
  195. }
  196. }),
  197. smalltalk.TestCase);
  198. smalltalk.addMethod(
  199. "_assert_equals_",
  200. smalltalk.method({
  201. selector: "assert:equals:",
  202. fn: function (expected, actual) {
  203. var self = this;
  204. var $1;
  205. $1 = 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", [])])]);
  206. return $1;
  207. }
  208. }),
  209. smalltalk.TestCase);
  210. smalltalk.addMethod(
  211. "_async_",
  212. smalltalk.method({
  213. selector: "async:",
  214. fn: function (aBlock){
  215. var self=this;
  216. var $2,$1;
  217. var c;
  218. smalltalk.send(self,"_mustBeAsync_",["#async"]);
  219. c=self["@context"];
  220. $1=(function(){
  221. $2=smalltalk.send(self,"_isAsync",[]);
  222. if(smalltalk.assert($2)){
  223. return smalltalk.send(c,"_execute_",[aBlock]);
  224. };
  225. });
  226. return $1;
  227. }
  228. }),
  229. smalltalk.TestCase);
  230. smalltalk.addMethod(
  231. "_context_",
  232. smalltalk.method({
  233. selector: "context:",
  234. fn: function (aRunningTestContext){
  235. var self=this;
  236. self["@context"]=aRunningTestContext;
  237. return self}
  238. }),
  239. smalltalk.TestCase);
  240. smalltalk.addMethod(
  241. "_deny_",
  242. smalltalk.method({
  243. selector: "deny:",
  244. fn: function (aBoolean) {
  245. var self = this;
  246. smalltalk.send(self, "_assert_", [smalltalk.send(aBoolean, "_not", [])]);
  247. return self;
  248. }
  249. }),
  250. smalltalk.TestCase);
  251. smalltalk.addMethod(
  252. "_finished",
  253. smalltalk.method({
  254. selector: "finished",
  255. fn: function (){
  256. var self=this;
  257. smalltalk.send(self,"_mustBeAsync_",["#finished"]);
  258. self["@asyncTimeout"]=nil;
  259. return self}
  260. }),
  261. smalltalk.TestCase);
  262. smalltalk.addMethod(
  263. "_graceTime_",
  264. smalltalk.method({
  265. selector: "graceTime:",
  266. fn: function (millis){
  267. var self=this;
  268. if(($receiver = self["@asyncTimeout"]) == nil || $receiver == undefined){
  269. self["@asyncTimeout"];
  270. } else {
  271. smalltalk.send(self["@asyncTimeout"],"_clearTimeout",[]);
  272. };
  273. self["@asyncTimeout"]=true;
  274. self["@asyncTimeout"]=smalltalk.send(smalltalk.send(self,"_async_",[(function(){
  275. return smalltalk.send(self,"_assert_description_",[false,"SUnit grace time exhausted"]);
  276. })]),"_valueWithTimeout_",[millis]);
  277. return self}
  278. }),
  279. smalltalk.TestCase);
  280. smalltalk.addMethod(
  281. "_isAsync",
  282. smalltalk.method({
  283. selector: "isAsync",
  284. fn: function (){
  285. var self=this;
  286. var $1;
  287. $1=smalltalk.send(self["@asyncTimeout"],"_notNil",[]);
  288. return $1;
  289. }
  290. }),
  291. smalltalk.TestCase);
  292. smalltalk.addMethod(
  293. "_mustBeAsync_",
  294. smalltalk.method({
  295. selector: "mustBeAsync:",
  296. fn: function (aString){
  297. var self=this;
  298. var $1;
  299. $1=smalltalk.send(self,"_isAsync",[]);
  300. if(! smalltalk.assert($1)){
  301. smalltalk.send(self,"_error_",[smalltalk.send(aString,"__comma",[" used without prior #graceTime:"])]);
  302. };
  303. return self}
  304. }),
  305. smalltalk.TestCase);
  306. smalltalk.addMethod(
  307. "_performTest",
  308. smalltalk.method({
  309. selector: "performTest",
  310. fn: function (){
  311. var self=this;
  312. self["@asyncTimeout"]=nil;
  313. smalltalk.send(self,"_perform_",[smalltalk.send(self,"_selector",[])]);
  314. return self}
  315. }),
  316. smalltalk.TestCase);
  317. smalltalk.addMethod(
  318. "_runCase",
  319. smalltalk.method({
  320. selector: "runCase",
  321. fn: function (){
  322. var self=this;
  323. smalltalk.send(smalltalk.send((smalltalk.ErroringTestContext || ErroringTestContext),"_testCase_",[self]),"_start",[]);
  324. return self}
  325. }),
  326. smalltalk.TestCase);
  327. smalltalk.addMethod(
  328. "_selector",
  329. smalltalk.method({
  330. selector: "selector",
  331. fn: function () {
  332. var self = this;
  333. return self['@testSelector'];
  334. }
  335. }),
  336. smalltalk.TestCase);
  337. smalltalk.addMethod(
  338. "_setTestSelector_",
  339. smalltalk.method({
  340. selector: "setTestSelector:",
  341. fn: function (aSelector) {
  342. var self = this;
  343. self['@testSelector'] = aSelector;
  344. return self;
  345. }
  346. }),
  347. smalltalk.TestCase);
  348. smalltalk.addMethod(
  349. "_setUp",
  350. smalltalk.method({
  351. selector: "setUp",
  352. fn: function () {
  353. var self = this;
  354. return self;
  355. }
  356. }),
  357. smalltalk.TestCase);
  358. smalltalk.addMethod(
  359. "_should_",
  360. smalltalk.method({
  361. selector: "should:",
  362. fn: function (aBlock) {
  363. var self = this;
  364. smalltalk.send(self, "_assert_", [smalltalk.send(aBlock, "_value", [])]);
  365. return self;
  366. }
  367. }),
  368. smalltalk.TestCase);
  369. smalltalk.addMethod(
  370. "_should_raise_",
  371. smalltalk.method({
  372. selector: "should:raise:",
  373. fn: function (aBlock, anExceptionClass) {
  374. var self = this;
  375. smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return false;}, "_on_do_", [anExceptionClass, function (ex) {return true;}])]);
  376. return self;
  377. }
  378. }),
  379. smalltalk.TestCase);
  380. smalltalk.addMethod(
  381. "_shouldnt_raise_",
  382. smalltalk.method({
  383. selector: "shouldnt:raise:",
  384. fn: function (aBlock, anExceptionClass) {
  385. var self = this;
  386. smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return true;}, "_on_do_", [anExceptionClass, function (ex) {return false;}])]);
  387. return self;
  388. }
  389. }),
  390. smalltalk.TestCase);
  391. smalltalk.addMethod(
  392. "_signalFailure_",
  393. smalltalk.method({
  394. selector: "signalFailure:",
  395. fn: function (aString) {
  396. var self = this;
  397. var $1, $2;
  398. $1 = smalltalk.send(smalltalk.TestFailure || TestFailure, "_new", []);
  399. smalltalk.send($1, "_messageText_", [aString]);
  400. $2 = smalltalk.send($1, "_signal", []);
  401. return self;
  402. }
  403. }),
  404. smalltalk.TestCase);
  405. smalltalk.addMethod(
  406. "_tearDown",
  407. smalltalk.method({
  408. selector: "tearDown",
  409. fn: function () {
  410. var self = this;
  411. return self;
  412. }
  413. }),
  414. smalltalk.TestCase);
  415. smalltalk.addMethod(
  416. "_allTestSelectors",
  417. smalltalk.method({
  418. selector: "allTestSelectors",
  419. fn: function () {
  420. var self = this;
  421. var $1;
  422. var selectors;
  423. selectors = smalltalk.send(self, "_testSelectors", []);
  424. $1 = smalltalk.send(self, "_shouldInheritSelectors", []);
  425. if (smalltalk.assert($1)) {
  426. smalltalk.send(selectors, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allTestSelectors", [])]);
  427. }
  428. return selectors;
  429. }
  430. }),
  431. smalltalk.TestCase.klass);
  432. smalltalk.addMethod(
  433. "_buildSuite",
  434. smalltalk.method({
  435. selector: "buildSuite",
  436. fn: function () {
  437. var self = this;
  438. var $1;
  439. $1 = smalltalk.send(smalltalk.send(self, "_allTestSelectors", []), "_collect_", [function (each) {return smalltalk.send(self, "_selector_", [each]);}]);
  440. return $1;
  441. }
  442. }),
  443. smalltalk.TestCase.klass);
  444. smalltalk.addMethod(
  445. "_isAbstract",
  446. smalltalk.method({
  447. selector: "isAbstract",
  448. fn: function () {
  449. var self = this;
  450. var $1;
  451. $1 = smalltalk.send(smalltalk.send(self, "_name", []), "__eq", ["TestCase"]);
  452. return $1;
  453. }
  454. }),
  455. smalltalk.TestCase.klass);
  456. smalltalk.addMethod(
  457. "_lookupHierarchyRoot",
  458. smalltalk.method({
  459. selector: "lookupHierarchyRoot",
  460. fn: function () {
  461. var self = this;
  462. return smalltalk.TestCase || TestCase;
  463. }
  464. }),
  465. smalltalk.TestCase.klass);
  466. smalltalk.addMethod(
  467. "_selector_",
  468. smalltalk.method({
  469. selector: "selector:",
  470. fn: function (aSelector) {
  471. var self = this;
  472. var $2, $3, $1;
  473. $2 = smalltalk.send(self, "_new", []);
  474. smalltalk.send($2, "_setTestSelector_", [aSelector]);
  475. $3 = smalltalk.send($2, "_yourself", []);
  476. $1 = $3;
  477. return $1;
  478. }
  479. }),
  480. smalltalk.TestCase.klass);
  481. smalltalk.addMethod(
  482. "_shouldInheritSelectors",
  483. smalltalk.method({
  484. selector: "shouldInheritSelectors",
  485. fn: function () {
  486. var self = this;
  487. var $1;
  488. $1 = smalltalk.send(self, "_~_eq", [smalltalk.send(self, "_lookupHierarchyRoot", [])]);
  489. return $1;
  490. }
  491. }),
  492. smalltalk.TestCase.klass);
  493. smalltalk.addMethod(
  494. "_testSelectors",
  495. smalltalk.method({
  496. selector: "testSelectors",
  497. fn: function () {
  498. var self = this;
  499. var $1;
  500. $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_keys", []), "_select_", [function (each) {return smalltalk.send(each, "_match_", ["^test"]);}]);
  501. return $1;
  502. }
  503. }),
  504. smalltalk.TestCase.klass);
  505. smalltalk.addClass('TestFailure', smalltalk.Error, [], 'SUnit');
  506. smalltalk.addClass('TestResult', smalltalk.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  507. smalltalk.addMethod(
  508. "_addError_",
  509. smalltalk.method({
  510. selector: "addError:",
  511. fn: function (anError) {
  512. var self = this;
  513. smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
  514. return self;
  515. }
  516. }),
  517. smalltalk.TestResult);
  518. smalltalk.addMethod(
  519. "_addFailure_",
  520. smalltalk.method({
  521. selector: "addFailure:",
  522. fn: function (aFailure) {
  523. var self = this;
  524. smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
  525. return self;
  526. }
  527. }),
  528. smalltalk.TestResult);
  529. smalltalk.addMethod(
  530. "_errors",
  531. smalltalk.method({
  532. selector: "errors",
  533. fn: function () {
  534. var self = this;
  535. return self['@errors'];
  536. }
  537. }),
  538. smalltalk.TestResult);
  539. smalltalk.addMethod(
  540. "_failures",
  541. smalltalk.method({
  542. selector: "failures",
  543. fn: function () {
  544. var self = this;
  545. return self['@failures'];
  546. }
  547. }),
  548. smalltalk.TestResult);
  549. smalltalk.addMethod(
  550. "_increaseRuns",
  551. smalltalk.method({
  552. selector: "increaseRuns",
  553. fn: function () {
  554. var self = this;
  555. self['@runs'] = smalltalk.send(self['@runs'], "__plus", [1]);
  556. return self;
  557. }
  558. }),
  559. smalltalk.TestResult);
  560. smalltalk.addMethod(
  561. "_initialize",
  562. smalltalk.method({
  563. selector: "initialize",
  564. fn: function () {
  565. var self = this;
  566. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  567. self['@timestamp'] = smalltalk.send(smalltalk.Date || Date, "_now", []);
  568. self['@runs'] = 0;
  569. self['@errors'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
  570. self['@failures'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
  571. self['@total'] = 0;
  572. return self;
  573. }
  574. }),
  575. smalltalk.TestResult);
  576. smalltalk.addMethod(
  577. "_runs",
  578. smalltalk.method({
  579. selector: "runs",
  580. fn: function () {
  581. var self = this;
  582. return self['@runs'];
  583. }
  584. }),
  585. smalltalk.TestResult);
  586. smalltalk.addMethod(
  587. "_status",
  588. smalltalk.method({
  589. selector: "status",
  590. fn: function () {
  591. var self = this;
  592. var $2, $3, $1;
  593. $2 = smalltalk.send(smalltalk.send(self, "_errors", []), "_isEmpty", []);
  594. if (smalltalk.assert($2)) {
  595. $3 = smalltalk.send(smalltalk.send(self, "_failures", []), "_isEmpty", []);
  596. if (smalltalk.assert($3)) {
  597. $1 = "success";
  598. } else {
  599. $1 = "failure";
  600. }
  601. } else {
  602. $1 = "error";
  603. }
  604. return $1;
  605. }
  606. }),
  607. smalltalk.TestResult);
  608. smalltalk.addMethod(
  609. "_timestamp",
  610. smalltalk.method({
  611. selector: "timestamp",
  612. fn: function () {
  613. var self = this;
  614. return self['@timestamp'];
  615. }
  616. }),
  617. smalltalk.TestResult);
  618. smalltalk.addMethod(
  619. "_total",
  620. smalltalk.method({
  621. selector: "total",
  622. fn: function () {
  623. var self = this;
  624. return self['@total'];
  625. }
  626. }),
  627. smalltalk.TestResult);
  628. smalltalk.addMethod(
  629. "_total_",
  630. smalltalk.method({
  631. selector: "total:",
  632. fn: function (aNumber) {
  633. var self = this;
  634. self['@total'] = aNumber;
  635. return self;
  636. }
  637. }),
  638. smalltalk.TestResult);
  639. smalltalk.addClass('TestSuiteRunner', smalltalk.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  640. smalltalk.addMethod(
  641. "_announcer",
  642. smalltalk.method({
  643. selector: "announcer",
  644. fn: function (){
  645. var self=this;
  646. return self["@announcer"];
  647. }
  648. }),
  649. smalltalk.TestSuiteRunner);
  650. smalltalk.addMethod(
  651. "_contextOf_",
  652. smalltalk.method({
  653. selector: "contextOf:",
  654. fn: function (anInteger){
  655. var self=this;
  656. var $1;
  657. $1=smalltalk.send((smalltalk.RunningTestContext || RunningTestContext),"_testCase_result_finished_",[smalltalk.send(self["@suite"],"_at_",[anInteger]),self["@result"],(function(){
  658. return smalltalk.send(self,"_resume",[]);
  659. })]);
  660. return $1;
  661. }
  662. }),
  663. smalltalk.TestSuiteRunner);
  664. smalltalk.addMethod(
  665. "_initialize",
  666. smalltalk.method({
  667. selector: "initialize",
  668. fn: function (){
  669. var self=this;
  670. var $1;
  671. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  672. self["@announcer"]=smalltalk.send((smalltalk.Announcer || Announcer),"_new",[]);
  673. self["@result"]=smalltalk.send((smalltalk.TestResult || TestResult),"_new",[]);
  674. self["@runNextTest"]=(function(){
  675. var runs;
  676. runs=smalltalk.send(self["@result"],"_runs",[]);
  677. runs;
  678. $1=smalltalk.send(runs,"__lt",[smalltalk.send(self["@result"],"_total",[])]);
  679. if(smalltalk.assert($1)){
  680. return smalltalk.send(smalltalk.send(self,"_contextOf_",[smalltalk.send(runs,"__plus",[(1)])]),"_start",[]);
  681. };
  682. });
  683. return self}
  684. }),
  685. smalltalk.TestSuiteRunner);
  686. smalltalk.addMethod(
  687. "_result",
  688. smalltalk.method({
  689. selector: "result",
  690. fn: function (){
  691. var self=this;
  692. return self["@result"];
  693. }
  694. }),
  695. smalltalk.TestSuiteRunner);
  696. smalltalk.addMethod(
  697. "_resume",
  698. smalltalk.method({
  699. selector: "resume",
  700. fn: function (){
  701. var self=this;
  702. smalltalk.send(self["@runNextTest"],"_fork",[]);
  703. smalltalk.send(self["@announcer"],"_announce_",[smalltalk.send(smalltalk.send((smalltalk.ResultAnnouncement || ResultAnnouncement),"_new",[]),"_result_",[self["@result"]])]);
  704. return self}
  705. }),
  706. smalltalk.TestSuiteRunner);
  707. smalltalk.addMethod(
  708. "_run",
  709. smalltalk.method({
  710. selector: "run",
  711. fn: function (){
  712. var self=this;
  713. smalltalk.send(self["@result"],"_total_",[smalltalk.send(self["@suite"],"_size",[])]);
  714. smalltalk.send(self,"_resume",[]);
  715. return self}
  716. }),
  717. smalltalk.TestSuiteRunner);
  718. smalltalk.addMethod(
  719. "_suite_",
  720. smalltalk.method({
  721. selector: "suite:",
  722. fn: function (aCollection){
  723. var self=this;
  724. self["@suite"]=aCollection;
  725. return self}
  726. }),
  727. smalltalk.TestSuiteRunner);
  728. smalltalk.addMethod(
  729. "_new",
  730. smalltalk.method({
  731. selector: "new",
  732. fn: function (){
  733. var self=this;
  734. smalltalk.send(self,"_shouldNotImplement",[]);
  735. return self}
  736. }),
  737. smalltalk.TestSuiteRunner.klass);
  738. smalltalk.addMethod(
  739. "_on_",
  740. smalltalk.method({
  741. selector: "on:",
  742. fn: function (aCollection){
  743. var self=this;
  744. var $1;
  745. $1=smalltalk.send(smalltalk.send(self,"_new",[],smalltalk.Object.klass),"_suite_",[aCollection]);
  746. return $1;
  747. }
  748. }),
  749. smalltalk.TestSuiteRunner.klass);