1
0

SUnit.deploy.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  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. self["@asyncTimeout"]=true;
  269. return self}
  270. }),
  271. smalltalk.TestCase);
  272. smalltalk.addMethod(
  273. "_isAsync",
  274. smalltalk.method({
  275. selector: "isAsync",
  276. fn: function (){
  277. var self=this;
  278. var $1;
  279. $1=smalltalk.send(self["@asyncTimeout"],"_notNil",[]);
  280. return $1;
  281. }
  282. }),
  283. smalltalk.TestCase);
  284. smalltalk.addMethod(
  285. "_mustBeAsync_",
  286. smalltalk.method({
  287. selector: "mustBeAsync:",
  288. fn: function (aString){
  289. var self=this;
  290. var $1;
  291. $1=smalltalk.send(self,"_isAsync",[]);
  292. if(! smalltalk.assert($1)){
  293. smalltalk.send(self,"_error_",[smalltalk.send(aString,"__comma",[" used without prior #graceTime:"])]);
  294. };
  295. return self}
  296. }),
  297. smalltalk.TestCase);
  298. smalltalk.addMethod(
  299. "_performTest",
  300. smalltalk.method({
  301. selector: "performTest",
  302. fn: function (){
  303. var self=this;
  304. self["@asyncTimeout"]=nil;
  305. smalltalk.send(self,"_perform_",[smalltalk.send(self,"_selector",[])]);
  306. return self}
  307. }),
  308. smalltalk.TestCase);
  309. smalltalk.addMethod(
  310. "_runCase",
  311. smalltalk.method({
  312. selector: "runCase",
  313. fn: function (){
  314. var self=this;
  315. smalltalk.send(smalltalk.send((smalltalk.ErroringTestContext || ErroringTestContext),"_testCase_",[self]),"_start",[]);
  316. return self}
  317. }),
  318. smalltalk.TestCase);
  319. smalltalk.addMethod(
  320. "_selector",
  321. smalltalk.method({
  322. selector: "selector",
  323. fn: function () {
  324. var self = this;
  325. return self['@testSelector'];
  326. }
  327. }),
  328. smalltalk.TestCase);
  329. smalltalk.addMethod(
  330. "_setTestSelector_",
  331. smalltalk.method({
  332. selector: "setTestSelector:",
  333. fn: function (aSelector) {
  334. var self = this;
  335. self['@testSelector'] = aSelector;
  336. return self;
  337. }
  338. }),
  339. smalltalk.TestCase);
  340. smalltalk.addMethod(
  341. "_setUp",
  342. smalltalk.method({
  343. selector: "setUp",
  344. fn: function () {
  345. var self = this;
  346. return self;
  347. }
  348. }),
  349. smalltalk.TestCase);
  350. smalltalk.addMethod(
  351. "_should_",
  352. smalltalk.method({
  353. selector: "should:",
  354. fn: function (aBlock) {
  355. var self = this;
  356. smalltalk.send(self, "_assert_", [smalltalk.send(aBlock, "_value", [])]);
  357. return self;
  358. }
  359. }),
  360. smalltalk.TestCase);
  361. smalltalk.addMethod(
  362. "_should_raise_",
  363. smalltalk.method({
  364. selector: "should:raise:",
  365. fn: function (aBlock, anExceptionClass) {
  366. var self = this;
  367. smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return false;}, "_on_do_", [anExceptionClass, function (ex) {return true;}])]);
  368. return self;
  369. }
  370. }),
  371. smalltalk.TestCase);
  372. smalltalk.addMethod(
  373. "_shouldnt_raise_",
  374. smalltalk.method({
  375. selector: "shouldnt:raise:",
  376. fn: function (aBlock, anExceptionClass) {
  377. var self = this;
  378. smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return true;}, "_on_do_", [anExceptionClass, function (ex) {return false;}])]);
  379. return self;
  380. }
  381. }),
  382. smalltalk.TestCase);
  383. smalltalk.addMethod(
  384. "_signalFailure_",
  385. smalltalk.method({
  386. selector: "signalFailure:",
  387. fn: function (aString) {
  388. var self = this;
  389. var $1, $2;
  390. $1 = smalltalk.send(smalltalk.TestFailure || TestFailure, "_new", []);
  391. smalltalk.send($1, "_messageText_", [aString]);
  392. $2 = smalltalk.send($1, "_signal", []);
  393. return self;
  394. }
  395. }),
  396. smalltalk.TestCase);
  397. smalltalk.addMethod(
  398. "_tearDown",
  399. smalltalk.method({
  400. selector: "tearDown",
  401. fn: function () {
  402. var self = this;
  403. return self;
  404. }
  405. }),
  406. smalltalk.TestCase);
  407. smalltalk.addMethod(
  408. "_allTestSelectors",
  409. smalltalk.method({
  410. selector: "allTestSelectors",
  411. fn: function () {
  412. var self = this;
  413. var $1;
  414. var selectors;
  415. selectors = smalltalk.send(self, "_testSelectors", []);
  416. $1 = smalltalk.send(self, "_shouldInheritSelectors", []);
  417. if (smalltalk.assert($1)) {
  418. smalltalk.send(selectors, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allTestSelectors", [])]);
  419. }
  420. return selectors;
  421. }
  422. }),
  423. smalltalk.TestCase.klass);
  424. smalltalk.addMethod(
  425. "_buildSuite",
  426. smalltalk.method({
  427. selector: "buildSuite",
  428. fn: function () {
  429. var self = this;
  430. var $1;
  431. $1 = smalltalk.send(smalltalk.send(self, "_allTestSelectors", []), "_collect_", [function (each) {return smalltalk.send(self, "_selector_", [each]);}]);
  432. return $1;
  433. }
  434. }),
  435. smalltalk.TestCase.klass);
  436. smalltalk.addMethod(
  437. "_isAbstract",
  438. smalltalk.method({
  439. selector: "isAbstract",
  440. fn: function () {
  441. var self = this;
  442. var $1;
  443. $1 = smalltalk.send(smalltalk.send(self, "_name", []), "__eq", ["TestCase"]);
  444. return $1;
  445. }
  446. }),
  447. smalltalk.TestCase.klass);
  448. smalltalk.addMethod(
  449. "_lookupHierarchyRoot",
  450. smalltalk.method({
  451. selector: "lookupHierarchyRoot",
  452. fn: function () {
  453. var self = this;
  454. return smalltalk.TestCase || TestCase;
  455. }
  456. }),
  457. smalltalk.TestCase.klass);
  458. smalltalk.addMethod(
  459. "_selector_",
  460. smalltalk.method({
  461. selector: "selector:",
  462. fn: function (aSelector) {
  463. var self = this;
  464. var $2, $3, $1;
  465. $2 = smalltalk.send(self, "_new", []);
  466. smalltalk.send($2, "_setTestSelector_", [aSelector]);
  467. $3 = smalltalk.send($2, "_yourself", []);
  468. $1 = $3;
  469. return $1;
  470. }
  471. }),
  472. smalltalk.TestCase.klass);
  473. smalltalk.addMethod(
  474. "_shouldInheritSelectors",
  475. smalltalk.method({
  476. selector: "shouldInheritSelectors",
  477. fn: function () {
  478. var self = this;
  479. var $1;
  480. $1 = smalltalk.send(self, "_~_eq", [smalltalk.send(self, "_lookupHierarchyRoot", [])]);
  481. return $1;
  482. }
  483. }),
  484. smalltalk.TestCase.klass);
  485. smalltalk.addMethod(
  486. "_testSelectors",
  487. smalltalk.method({
  488. selector: "testSelectors",
  489. fn: function () {
  490. var self = this;
  491. var $1;
  492. $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_keys", []), "_select_", [function (each) {return smalltalk.send(each, "_match_", ["^test"]);}]);
  493. return $1;
  494. }
  495. }),
  496. smalltalk.TestCase.klass);
  497. smalltalk.addClass('TestFailure', smalltalk.Error, [], 'SUnit');
  498. smalltalk.addClass('TestResult', smalltalk.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  499. smalltalk.addMethod(
  500. "_addError_",
  501. smalltalk.method({
  502. selector: "addError:",
  503. fn: function (anError) {
  504. var self = this;
  505. smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
  506. return self;
  507. }
  508. }),
  509. smalltalk.TestResult);
  510. smalltalk.addMethod(
  511. "_addFailure_",
  512. smalltalk.method({
  513. selector: "addFailure:",
  514. fn: function (aFailure) {
  515. var self = this;
  516. smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
  517. return self;
  518. }
  519. }),
  520. smalltalk.TestResult);
  521. smalltalk.addMethod(
  522. "_errors",
  523. smalltalk.method({
  524. selector: "errors",
  525. fn: function () {
  526. var self = this;
  527. return self['@errors'];
  528. }
  529. }),
  530. smalltalk.TestResult);
  531. smalltalk.addMethod(
  532. "_failures",
  533. smalltalk.method({
  534. selector: "failures",
  535. fn: function () {
  536. var self = this;
  537. return self['@failures'];
  538. }
  539. }),
  540. smalltalk.TestResult);
  541. smalltalk.addMethod(
  542. "_increaseRuns",
  543. smalltalk.method({
  544. selector: "increaseRuns",
  545. fn: function () {
  546. var self = this;
  547. self['@runs'] = smalltalk.send(self['@runs'], "__plus", [1]);
  548. return self;
  549. }
  550. }),
  551. smalltalk.TestResult);
  552. smalltalk.addMethod(
  553. "_initialize",
  554. smalltalk.method({
  555. selector: "initialize",
  556. fn: function () {
  557. var self = this;
  558. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  559. self['@timestamp'] = smalltalk.send(smalltalk.Date || Date, "_now", []);
  560. self['@runs'] = 0;
  561. self['@errors'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
  562. self['@failures'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
  563. self['@total'] = 0;
  564. return self;
  565. }
  566. }),
  567. smalltalk.TestResult);
  568. smalltalk.addMethod(
  569. "_runs",
  570. smalltalk.method({
  571. selector: "runs",
  572. fn: function () {
  573. var self = this;
  574. return self['@runs'];
  575. }
  576. }),
  577. smalltalk.TestResult);
  578. smalltalk.addMethod(
  579. "_status",
  580. smalltalk.method({
  581. selector: "status",
  582. fn: function () {
  583. var self = this;
  584. var $2, $3, $1;
  585. $2 = smalltalk.send(smalltalk.send(self, "_errors", []), "_isEmpty", []);
  586. if (smalltalk.assert($2)) {
  587. $3 = smalltalk.send(smalltalk.send(self, "_failures", []), "_isEmpty", []);
  588. if (smalltalk.assert($3)) {
  589. $1 = "success";
  590. } else {
  591. $1 = "failure";
  592. }
  593. } else {
  594. $1 = "error";
  595. }
  596. return $1;
  597. }
  598. }),
  599. smalltalk.TestResult);
  600. smalltalk.addMethod(
  601. "_timestamp",
  602. smalltalk.method({
  603. selector: "timestamp",
  604. fn: function () {
  605. var self = this;
  606. return self['@timestamp'];
  607. }
  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. }
  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. }),
  630. smalltalk.TestResult);
  631. smalltalk.addClass('TestSuiteRunner', smalltalk.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  632. smalltalk.addMethod(
  633. "_announcer",
  634. smalltalk.method({
  635. selector: "announcer",
  636. fn: function (){
  637. var self=this;
  638. return self["@announcer"];
  639. }
  640. }),
  641. smalltalk.TestSuiteRunner);
  642. smalltalk.addMethod(
  643. "_contextOf_",
  644. smalltalk.method({
  645. selector: "contextOf:",
  646. fn: function (anInteger){
  647. var self=this;
  648. var $1;
  649. $1=smalltalk.send((smalltalk.RunningTestContext || RunningTestContext),"_testCase_result_finished_",[smalltalk.send(self["@suite"],"_at_",[anInteger]),self["@result"],(function(){
  650. return smalltalk.send(self,"_resume",[]);
  651. })]);
  652. return $1;
  653. }
  654. }),
  655. smalltalk.TestSuiteRunner);
  656. smalltalk.addMethod(
  657. "_initialize",
  658. smalltalk.method({
  659. selector: "initialize",
  660. fn: function (){
  661. var self=this;
  662. var $1;
  663. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  664. self["@announcer"]=smalltalk.send((smalltalk.Announcer || Announcer),"_new",[]);
  665. self["@result"]=smalltalk.send((smalltalk.TestResult || TestResult),"_new",[]);
  666. self["@runNextTest"]=(function(){
  667. var runs;
  668. runs=smalltalk.send(self["@result"],"_runs",[]);
  669. runs;
  670. $1=smalltalk.send(runs,"__lt",[smalltalk.send(self["@result"],"_total",[])]);
  671. if(smalltalk.assert($1)){
  672. return smalltalk.send(smalltalk.send(self,"_contextOf_",[smalltalk.send(runs,"__plus",[(1)])]),"_start",[]);
  673. };
  674. });
  675. return self}
  676. }),
  677. smalltalk.TestSuiteRunner);
  678. smalltalk.addMethod(
  679. "_result",
  680. smalltalk.method({
  681. selector: "result",
  682. fn: function (){
  683. var self=this;
  684. return self["@result"];
  685. }
  686. }),
  687. smalltalk.TestSuiteRunner);
  688. smalltalk.addMethod(
  689. "_resume",
  690. smalltalk.method({
  691. selector: "resume",
  692. fn: function (){
  693. var self=this;
  694. smalltalk.send(self["@runNextTest"],"_fork",[]);
  695. smalltalk.send(self["@announcer"],"_announce_",[smalltalk.send(smalltalk.send((smalltalk.ResultAnnouncement || ResultAnnouncement),"_new",[]),"_result_",[self["@result"]])]);
  696. return self}
  697. }),
  698. smalltalk.TestSuiteRunner);
  699. smalltalk.addMethod(
  700. "_run",
  701. smalltalk.method({
  702. selector: "run",
  703. fn: function (){
  704. var self=this;
  705. smalltalk.send(self["@result"],"_total_",[smalltalk.send(self["@suite"],"_size",[])]);
  706. smalltalk.send(self,"_resume",[]);
  707. return self}
  708. }),
  709. smalltalk.TestSuiteRunner);
  710. smalltalk.addMethod(
  711. "_suite_",
  712. smalltalk.method({
  713. selector: "suite:",
  714. fn: function (aCollection){
  715. var self=this;
  716. self["@suite"]=aCollection;
  717. return self}
  718. }),
  719. smalltalk.TestSuiteRunner);
  720. smalltalk.addMethod(
  721. "_new",
  722. smalltalk.method({
  723. selector: "new",
  724. fn: function (){
  725. var self=this;
  726. smalltalk.send(self,"_shouldNotImplement",[]);
  727. return self}
  728. }),
  729. smalltalk.TestSuiteRunner.klass);
  730. smalltalk.addMethod(
  731. "_on_",
  732. smalltalk.method({
  733. selector: "on:",
  734. fn: function (aCollection){
  735. var self=this;
  736. var $1;
  737. $1=smalltalk.send(smalltalk.send(self,"_new",[],smalltalk.Object.klass),"_suite_",[aCollection]);
  738. return $1;
  739. }
  740. }),
  741. smalltalk.TestSuiteRunner.klass);