SUnit.deploy.js 18 KB

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