SUnit-Tests.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  1. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('SUnit-Tests');
  4. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "setUp",
  13. protocol: 'running',
  14. fn: function (){
  15. var self=this;
  16. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. self["@empty"]=$recv($Set())._new();
  21. self["@full"]=$recv($Set())._with_with_((5),"abc");
  22. return self;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  25. //>>excludeEnd("ctx");
  26. },
  27. //>>excludeStart("ide", pragmas.excludeIdeData);
  28. args: [],
  29. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  30. referencedClasses: ["Set"],
  31. //>>excludeEnd("ide");
  32. messageSends: ["new", "with:with:"]
  33. }),
  34. $globals.ExampleSetTest);
  35. $core.addMethod(
  36. $core.method({
  37. selector: "testAdd",
  38. protocol: 'tests',
  39. fn: function (){
  40. var self=this;
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx1) {
  43. //>>excludeEnd("ctx");
  44. $recv(self["@empty"])._add_((5));
  45. self._assert_($recv(self["@empty"])._includes_((5)));
  46. return self;
  47. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  49. //>>excludeEnd("ctx");
  50. },
  51. //>>excludeStart("ide", pragmas.excludeIdeData);
  52. args: [],
  53. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  54. referencedClasses: [],
  55. //>>excludeEnd("ide");
  56. messageSends: ["add:", "assert:", "includes:"]
  57. }),
  58. $globals.ExampleSetTest);
  59. $core.addMethod(
  60. $core.method({
  61. selector: "testGrow",
  62. protocol: 'tests',
  63. fn: function (){
  64. var self=this;
  65. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66. return $core.withContext(function($ctx1) {
  67. //>>excludeEnd("ctx");
  68. $recv(self["@empty"])._addAll_((1)._to_((100)));
  69. self._assert_equals_($recv(self["@empty"])._size(),(100));
  70. return self;
  71. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  73. //>>excludeEnd("ctx");
  74. },
  75. //>>excludeStart("ide", pragmas.excludeIdeData);
  76. args: [],
  77. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  78. referencedClasses: [],
  79. //>>excludeEnd("ide");
  80. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  81. }),
  82. $globals.ExampleSetTest);
  83. $core.addMethod(
  84. $core.method({
  85. selector: "testIllegal",
  86. protocol: 'tests',
  87. fn: function (){
  88. var self=this;
  89. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  90. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  91. return $core.withContext(function($ctx1) {
  92. //>>excludeEnd("ctx");
  93. self._should_raise_((function(){
  94. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  95. return $core.withContext(function($ctx2) {
  96. //>>excludeEnd("ctx");
  97. return $recv(self["@empty"])._at_((5));
  98. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  99. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  100. //>>excludeEnd("ctx");
  101. }),$Error());
  102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  103. $ctx1.sendIdx["should:raise:"]=1;
  104. //>>excludeEnd("ctx");
  105. self._should_raise_((function(){
  106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  107. return $core.withContext(function($ctx2) {
  108. //>>excludeEnd("ctx");
  109. return $recv(self["@empty"])._at_put_((5),"abc");
  110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  112. //>>excludeEnd("ctx");
  113. }),$Error());
  114. return self;
  115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  116. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  117. //>>excludeEnd("ctx");
  118. },
  119. //>>excludeStart("ide", pragmas.excludeIdeData);
  120. args: [],
  121. source: "testIllegal\x0a\x09self\x0a\x09\x09should: [ empty at: 5 ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ empty at: 5 put: #abc ]\x0a\x09\x09raise: Error",
  122. referencedClasses: ["Error"],
  123. //>>excludeEnd("ide");
  124. messageSends: ["should:raise:", "at:", "at:put:"]
  125. }),
  126. $globals.ExampleSetTest);
  127. $core.addMethod(
  128. $core.method({
  129. selector: "testIncludes",
  130. protocol: 'tests',
  131. fn: function (){
  132. var self=this;
  133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  134. return $core.withContext(function($ctx1) {
  135. //>>excludeEnd("ctx");
  136. var $1;
  137. $1=$recv(self["@full"])._includes_((5));
  138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  139. $ctx1.sendIdx["includes:"]=1;
  140. //>>excludeEnd("ctx");
  141. self._assert_($1);
  142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  143. $ctx1.sendIdx["assert:"]=1;
  144. //>>excludeEnd("ctx");
  145. self._assert_($recv(self["@full"])._includes_("abc"));
  146. return self;
  147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  148. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  149. //>>excludeEnd("ctx");
  150. },
  151. //>>excludeStart("ide", pragmas.excludeIdeData);
  152. args: [],
  153. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  154. referencedClasses: [],
  155. //>>excludeEnd("ide");
  156. messageSends: ["assert:", "includes:"]
  157. }),
  158. $globals.ExampleSetTest);
  159. $core.addMethod(
  160. $core.method({
  161. selector: "testOccurrences",
  162. protocol: 'tests',
  163. fn: function (){
  164. var self=this;
  165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  166. return $core.withContext(function($ctx1) {
  167. //>>excludeEnd("ctx");
  168. var $1,$2;
  169. $1=$recv(self["@empty"])._occurrencesOf_((0));
  170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  171. $ctx1.sendIdx["occurrencesOf:"]=1;
  172. //>>excludeEnd("ctx");
  173. self._assert_equals_($1,(0));
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. $ctx1.sendIdx["assert:equals:"]=1;
  176. //>>excludeEnd("ctx");
  177. $2=$recv(self["@full"])._occurrencesOf_((5));
  178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  179. $ctx1.sendIdx["occurrencesOf:"]=2;
  180. //>>excludeEnd("ctx");
  181. self._assert_equals_($2,(1));
  182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  183. $ctx1.sendIdx["assert:equals:"]=2;
  184. //>>excludeEnd("ctx");
  185. $recv(self["@full"])._add_((5));
  186. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  187. return self;
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  190. //>>excludeEnd("ctx");
  191. },
  192. //>>excludeStart("ide", pragmas.excludeIdeData);
  193. args: [],
  194. source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) equals: 0.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1",
  195. referencedClasses: [],
  196. //>>excludeEnd("ide");
  197. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  198. }),
  199. $globals.ExampleSetTest);
  200. $core.addMethod(
  201. $core.method({
  202. selector: "testRemove",
  203. protocol: 'tests',
  204. fn: function (){
  205. var self=this;
  206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  207. return $core.withContext(function($ctx1) {
  208. //>>excludeEnd("ctx");
  209. var $1;
  210. $recv(self["@full"])._remove_((5));
  211. $1=$recv(self["@full"])._includes_("abc");
  212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  213. $ctx1.sendIdx["includes:"]=1;
  214. //>>excludeEnd("ctx");
  215. self._assert_($1);
  216. self._deny_($recv(self["@full"])._includes_((5)));
  217. return self;
  218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  219. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  220. //>>excludeEnd("ctx");
  221. },
  222. //>>excludeStart("ide", pragmas.excludeIdeData);
  223. args: [],
  224. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  225. referencedClasses: [],
  226. //>>excludeEnd("ide");
  227. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  228. }),
  229. $globals.ExampleSetTest);
  230. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  231. $core.addMethod(
  232. $core.method({
  233. selector: "fakeError",
  234. protocol: 'helpers',
  235. fn: function (){
  236. var self=this;
  237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  238. return $core.withContext(function($ctx1) {
  239. //>>excludeEnd("ctx");
  240. self["@flag"]="bad";
  241. self._timeout_((30));
  242. self["@flag"]=$recv(self._async_((function(){
  243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  244. return $core.withContext(function($ctx2) {
  245. //>>excludeEnd("ctx");
  246. self["@flag"]="ok";
  247. self["@flag"];
  248. return self._error_("Intentional");
  249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  251. //>>excludeEnd("ctx");
  252. })))._valueWithTimeout_((20));
  253. return self;
  254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  255. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  256. //>>excludeEnd("ctx");
  257. },
  258. //>>excludeStart("ide", pragmas.excludeIdeData);
  259. args: [],
  260. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  261. referencedClasses: [],
  262. //>>excludeEnd("ide");
  263. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  264. }),
  265. $globals.SUnitAsyncTest);
  266. $core.addMethod(
  267. $core.method({
  268. selector: "fakeErrorFailingInTearDown",
  269. protocol: 'helpers',
  270. fn: function (){
  271. var self=this;
  272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  273. return $core.withContext(function($ctx1) {
  274. //>>excludeEnd("ctx");
  275. self["@flag"]="bad";
  276. self._timeout_((30));
  277. self["@flag"]=$recv(self._async_((function(){
  278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  279. return $core.withContext(function($ctx2) {
  280. //>>excludeEnd("ctx");
  281. return self._error_("Intentional");
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  284. //>>excludeEnd("ctx");
  285. })))._valueWithTimeout_((20));
  286. return self;
  287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  288. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  289. //>>excludeEnd("ctx");
  290. },
  291. //>>excludeStart("ide", pragmas.excludeIdeData);
  292. args: [],
  293. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  294. referencedClasses: [],
  295. //>>excludeEnd("ide");
  296. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  297. }),
  298. $globals.SUnitAsyncTest);
  299. $core.addMethod(
  300. $core.method({
  301. selector: "fakeFailure",
  302. protocol: 'helpers',
  303. fn: function (){
  304. var self=this;
  305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  306. return $core.withContext(function($ctx1) {
  307. //>>excludeEnd("ctx");
  308. self["@flag"]="bad";
  309. self._timeout_((30));
  310. self["@flag"]=$recv(self._async_((function(){
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. return $core.withContext(function($ctx2) {
  313. //>>excludeEnd("ctx");
  314. self["@flag"]="ok";
  315. self["@flag"];
  316. return self._assert_(false);
  317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  319. //>>excludeEnd("ctx");
  320. })))._valueWithTimeout_((20));
  321. return self;
  322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  323. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  324. //>>excludeEnd("ctx");
  325. },
  326. //>>excludeStart("ide", pragmas.excludeIdeData);
  327. args: [],
  328. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  329. referencedClasses: [],
  330. //>>excludeEnd("ide");
  331. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  332. }),
  333. $globals.SUnitAsyncTest);
  334. $core.addMethod(
  335. $core.method({
  336. selector: "fakeMultipleTimeoutFailing",
  337. protocol: 'helpers',
  338. fn: function (){
  339. var self=this;
  340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  341. return $core.withContext(function($ctx1) {
  342. //>>excludeEnd("ctx");
  343. var $1;
  344. self._timeout_((100));
  345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  346. $ctx1.sendIdx["timeout:"]=1;
  347. //>>excludeEnd("ctx");
  348. $1=self._async_((function(){
  349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  350. return $core.withContext(function($ctx2) {
  351. //>>excludeEnd("ctx");
  352. self._timeout_((20));
  353. return $recv(self._async_((function(){
  354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  355. return $core.withContext(function($ctx3) {
  356. //>>excludeEnd("ctx");
  357. return self._finished();
  358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  359. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  360. //>>excludeEnd("ctx");
  361. })))._valueWithTimeout_((30));
  362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  364. //>>excludeEnd("ctx");
  365. }));
  366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  367. $ctx1.sendIdx["async:"]=1;
  368. //>>excludeEnd("ctx");
  369. $recv($1)._valueWithTimeout_((20));
  370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  371. $ctx1.sendIdx["valueWithTimeout:"]=1;
  372. //>>excludeEnd("ctx");
  373. return self;
  374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  375. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  376. //>>excludeEnd("ctx");
  377. },
  378. //>>excludeStart("ide", pragmas.excludeIdeData);
  379. args: [],
  380. source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a\x09(self async: [ \x0a\x09\x09self timeout: 20.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 30\x0a\x09]) valueWithTimeout: 20",
  381. referencedClasses: [],
  382. //>>excludeEnd("ide");
  383. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  384. }),
  385. $globals.SUnitAsyncTest);
  386. $core.addMethod(
  387. $core.method({
  388. selector: "fakeMultipleTimeoutPassing",
  389. protocol: 'helpers',
  390. fn: function (){
  391. var self=this;
  392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  393. return $core.withContext(function($ctx1) {
  394. //>>excludeEnd("ctx");
  395. var $1;
  396. self._timeout_((20));
  397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  398. $ctx1.sendIdx["timeout:"]=1;
  399. //>>excludeEnd("ctx");
  400. $1=self._async_((function(){
  401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  402. return $core.withContext(function($ctx2) {
  403. //>>excludeEnd("ctx");
  404. self._timeout_((40));
  405. return $recv(self._async_((function(){
  406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  407. return $core.withContext(function($ctx3) {
  408. //>>excludeEnd("ctx");
  409. return self._finished();
  410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  411. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  412. //>>excludeEnd("ctx");
  413. })))._valueWithTimeout_((20));
  414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  416. //>>excludeEnd("ctx");
  417. }));
  418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  419. $ctx1.sendIdx["async:"]=1;
  420. //>>excludeEnd("ctx");
  421. $recv($1)._valueWithTimeout_((10));
  422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  423. $ctx1.sendIdx["valueWithTimeout:"]=1;
  424. //>>excludeEnd("ctx");
  425. return self;
  426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  427. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  428. //>>excludeEnd("ctx");
  429. },
  430. //>>excludeStart("ide", pragmas.excludeIdeData);
  431. args: [],
  432. source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 20.\x0a\x09(self async: [\x0a\x09\x09self timeout: 40.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 20\x0a\x09]) valueWithTimeout: 10",
  433. referencedClasses: [],
  434. //>>excludeEnd("ide");
  435. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  436. }),
  437. $globals.SUnitAsyncTest);
  438. $core.addMethod(
  439. $core.method({
  440. selector: "fakeTimeout",
  441. protocol: 'helpers',
  442. fn: function (){
  443. var self=this;
  444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  445. return $core.withContext(function($ctx1) {
  446. //>>excludeEnd("ctx");
  447. self._timeout_((10));
  448. $recv(self._async_((function(){
  449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  450. return $core.withContext(function($ctx2) {
  451. //>>excludeEnd("ctx");
  452. return self._finished();
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  455. //>>excludeEnd("ctx");
  456. })))._valueWithTimeout_((20));
  457. return self;
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  460. //>>excludeEnd("ctx");
  461. },
  462. //>>excludeStart("ide", pragmas.excludeIdeData);
  463. args: [],
  464. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  465. referencedClasses: [],
  466. //>>excludeEnd("ide");
  467. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  468. }),
  469. $globals.SUnitAsyncTest);
  470. $core.addMethod(
  471. $core.method({
  472. selector: "selectorSetOf:",
  473. protocol: 'private',
  474. fn: function (aCollection){
  475. var self=this;
  476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  477. return $core.withContext(function($ctx1) {
  478. //>>excludeEnd("ctx");
  479. return $recv($recv(aCollection)._collect_((function(each){
  480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  481. return $core.withContext(function($ctx2) {
  482. //>>excludeEnd("ctx");
  483. return $recv(each)._selector();
  484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  485. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  486. //>>excludeEnd("ctx");
  487. })))._asSet();
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  490. //>>excludeEnd("ctx");
  491. },
  492. //>>excludeStart("ide", pragmas.excludeIdeData);
  493. args: ["aCollection"],
  494. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  495. referencedClasses: [],
  496. //>>excludeEnd("ide");
  497. messageSends: ["asSet", "collect:", "selector"]
  498. }),
  499. $globals.SUnitAsyncTest);
  500. $core.addMethod(
  501. $core.method({
  502. selector: "setUp",
  503. protocol: 'running',
  504. fn: function (){
  505. var self=this;
  506. self["@flag"]="ok";
  507. return self;
  508. },
  509. //>>excludeStart("ide", pragmas.excludeIdeData);
  510. args: [],
  511. source: "setUp\x0a\x09flag := 'ok'",
  512. referencedClasses: [],
  513. //>>excludeEnd("ide");
  514. messageSends: []
  515. }),
  516. $globals.SUnitAsyncTest);
  517. $core.addMethod(
  518. $core.method({
  519. selector: "tearDown",
  520. protocol: 'running',
  521. fn: function (){
  522. var self=this;
  523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  524. return $core.withContext(function($ctx1) {
  525. //>>excludeEnd("ctx");
  526. self._assert_equals_("ok",self["@flag"]);
  527. return self;
  528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  529. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  530. //>>excludeEnd("ctx");
  531. },
  532. //>>excludeStart("ide", pragmas.excludeIdeData);
  533. args: [],
  534. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  535. referencedClasses: [],
  536. //>>excludeEnd("ide");
  537. messageSends: ["assert:equals:"]
  538. }),
  539. $globals.SUnitAsyncTest);
  540. $core.addMethod(
  541. $core.method({
  542. selector: "testAsyncErrorsAndFailures",
  543. protocol: 'tests',
  544. fn: function (){
  545. var self=this;
  546. var suite,runner,result,assertBlock;
  547. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  548. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  550. return $core.withContext(function($ctx1) {
  551. //>>excludeEnd("ctx");
  552. var $1,$2,$3,$4;
  553. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  555. return $core.withContext(function($ctx2) {
  556. //>>excludeEnd("ctx");
  557. return $recv(self._class())._selector_(each);
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  560. //>>excludeEnd("ctx");
  561. }));
  562. runner=$recv($TestSuiteRunner())._on_(suite);
  563. self._timeout_((200));
  564. result=$recv(runner)._result();
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. $ctx1.sendIdx["result"]=1;
  567. //>>excludeEnd("ctx");
  568. assertBlock=self._async_((function(){
  569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  570. return $core.withContext(function($ctx2) {
  571. //>>excludeEnd("ctx");
  572. $1=self._selectorSetOf_($recv(result)._errors());
  573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  574. $ctx2.sendIdx["selectorSetOf:"]=1;
  575. //>>excludeEnd("ctx");
  576. $2=["fakeError"]._asSet();
  577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  578. $ctx2.sendIdx["asSet"]=1;
  579. //>>excludeEnd("ctx");
  580. self._assert_equals_($1,$2);
  581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  582. $ctx2.sendIdx["assert:equals:"]=1;
  583. //>>excludeEnd("ctx");
  584. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  585. return self._finished();
  586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  588. //>>excludeEnd("ctx");
  589. }));
  590. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  592. return $core.withContext(function($ctx2) {
  593. //>>excludeEnd("ctx");
  594. $3=$recv($recv(ann)._result()).__eq_eq(result);
  595. if($core.assert($3)){
  596. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  597. return $recv($4)._ifTrue_(assertBlock);
  598. };
  599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  600. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  601. //>>excludeEnd("ctx");
  602. }));
  603. $recv(runner)._run();
  604. return self;
  605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  606. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  607. //>>excludeEnd("ctx");
  608. },
  609. //>>excludeStart("ide", pragmas.excludeIdeData);
  610. args: [],
  611. source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  612. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  613. //>>excludeEnd("ide");
  614. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  615. }),
  616. $globals.SUnitAsyncTest);
  617. $core.addMethod(
  618. $core.method({
  619. selector: "testAsyncNeedsTimeout",
  620. protocol: 'tests',
  621. fn: function (){
  622. var self=this;
  623. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  625. return $core.withContext(function($ctx1) {
  626. //>>excludeEnd("ctx");
  627. self._should_raise_((function(){
  628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  629. return $core.withContext(function($ctx2) {
  630. //>>excludeEnd("ctx");
  631. return self._async_((function(){
  632. }));
  633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  634. $ctx2.sendIdx["async:"]=1;
  635. //>>excludeEnd("ctx");
  636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  638. //>>excludeEnd("ctx");
  639. }),$Error());
  640. self._timeout_((0));
  641. self._shouldnt_raise_((function(){
  642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  643. return $core.withContext(function($ctx2) {
  644. //>>excludeEnd("ctx");
  645. return self._async_((function(){
  646. }));
  647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  649. //>>excludeEnd("ctx");
  650. }),$Error());
  651. self._finished();
  652. return self;
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  655. //>>excludeEnd("ctx");
  656. },
  657. //>>excludeStart("ide", pragmas.excludeIdeData);
  658. args: [],
  659. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  660. referencedClasses: ["Error"],
  661. //>>excludeEnd("ide");
  662. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  663. }),
  664. $globals.SUnitAsyncTest);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "testFinishedNeedsTimeout",
  668. protocol: 'tests',
  669. fn: function (){
  670. var self=this;
  671. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  673. return $core.withContext(function($ctx1) {
  674. //>>excludeEnd("ctx");
  675. self._should_raise_((function(){
  676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  677. return $core.withContext(function($ctx2) {
  678. //>>excludeEnd("ctx");
  679. return self._finished();
  680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  681. $ctx2.sendIdx["finished"]=1;
  682. //>>excludeEnd("ctx");
  683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  685. //>>excludeEnd("ctx");
  686. }),$Error());
  687. self._timeout_((0));
  688. self._shouldnt_raise_((function(){
  689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  690. return $core.withContext(function($ctx2) {
  691. //>>excludeEnd("ctx");
  692. return self._finished();
  693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  695. //>>excludeEnd("ctx");
  696. }),$Error());
  697. return self;
  698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  699. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  700. //>>excludeEnd("ctx");
  701. },
  702. //>>excludeStart("ide", pragmas.excludeIdeData);
  703. args: [],
  704. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  705. referencedClasses: ["Error"],
  706. //>>excludeEnd("ide");
  707. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  708. }),
  709. $globals.SUnitAsyncTest);
  710. $core.addMethod(
  711. $core.method({
  712. selector: "testIsAsyncReturnsCorrectValues",
  713. protocol: 'tests',
  714. fn: function (){
  715. var self=this;
  716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  717. return $core.withContext(function($ctx1) {
  718. //>>excludeEnd("ctx");
  719. var $1,$2;
  720. $1=self._isAsync();
  721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  722. $ctx1.sendIdx["isAsync"]=1;
  723. //>>excludeEnd("ctx");
  724. self._deny_($1);
  725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  726. $ctx1.sendIdx["deny:"]=1;
  727. //>>excludeEnd("ctx");
  728. self._timeout_((0));
  729. $2=self._isAsync();
  730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  731. $ctx1.sendIdx["isAsync"]=2;
  732. //>>excludeEnd("ctx");
  733. self._assert_($2);
  734. self._finished();
  735. self._deny_(self._isAsync());
  736. return self;
  737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  738. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  739. //>>excludeEnd("ctx");
  740. },
  741. //>>excludeStart("ide", pragmas.excludeIdeData);
  742. args: [],
  743. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  744. referencedClasses: [],
  745. //>>excludeEnd("ide");
  746. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  747. }),
  748. $globals.SUnitAsyncTest);
  749. $core.addMethod(
  750. $core.method({
  751. selector: "testPass",
  752. protocol: 'tests',
  753. fn: function (){
  754. var self=this;
  755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  756. return $core.withContext(function($ctx1) {
  757. //>>excludeEnd("ctx");
  758. self["@flag"]="bad";
  759. self._timeout_((10));
  760. self["@flag"]=$recv(self._async_((function(){
  761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  762. return $core.withContext(function($ctx2) {
  763. //>>excludeEnd("ctx");
  764. self._assert_(true);
  765. self._finished();
  766. self["@flag"]="ok";
  767. return self["@flag"];
  768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  770. //>>excludeEnd("ctx");
  771. })))._valueWithTimeout_((5));
  772. return self;
  773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  774. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  775. //>>excludeEnd("ctx");
  776. },
  777. //>>excludeStart("ide", pragmas.excludeIdeData);
  778. args: [],
  779. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  780. referencedClasses: [],
  781. //>>excludeEnd("ide");
  782. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  783. }),
  784. $globals.SUnitAsyncTest);
  785. $core.addMethod(
  786. $core.method({
  787. selector: "testTimeouts",
  788. protocol: 'tests',
  789. fn: function (){
  790. var self=this;
  791. var suite,runner,result,assertBlock;
  792. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  793. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  794. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  796. return $core.withContext(function($ctx1) {
  797. //>>excludeEnd("ctx");
  798. var $1,$2,$3;
  799. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  801. return $core.withContext(function($ctx2) {
  802. //>>excludeEnd("ctx");
  803. return $recv(self._class())._selector_(each);
  804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  806. //>>excludeEnd("ctx");
  807. }));
  808. runner=$recv($TestSuiteRunner())._on_(suite);
  809. self._timeout_((200));
  810. result=$recv(runner)._result();
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. $ctx1.sendIdx["result"]=1;
  813. //>>excludeEnd("ctx");
  814. assertBlock=self._async_((function(){
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. return $core.withContext(function($ctx2) {
  817. //>>excludeEnd("ctx");
  818. $1=self._selectorSetOf_($recv(result)._errors());
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. $ctx2.sendIdx["selectorSetOf:"]=1;
  821. //>>excludeEnd("ctx");
  822. self._assert_equals_($1,$recv($Set())._new());
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. $ctx2.sendIdx["assert:equals:"]=1;
  825. //>>excludeEnd("ctx");
  826. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  827. return self._finished();
  828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  830. //>>excludeEnd("ctx");
  831. }));
  832. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  834. return $core.withContext(function($ctx2) {
  835. //>>excludeEnd("ctx");
  836. $2=$recv($recv(ann)._result()).__eq_eq(result);
  837. if($core.assert($2)){
  838. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  839. return $recv($3)._ifTrue_(assertBlock);
  840. };
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  843. //>>excludeEnd("ctx");
  844. }));
  845. $recv(runner)._run();
  846. return self;
  847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  848. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  849. //>>excludeEnd("ctx");
  850. },
  851. //>>excludeStart("ide", pragmas.excludeIdeData);
  852. args: [],
  853. source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: Set new.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  854. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  855. //>>excludeEnd("ide");
  856. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  857. }),
  858. $globals.SUnitAsyncTest);
  859. $core.addMethod(
  860. $core.method({
  861. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  862. protocol: 'tests',
  863. fn: function (){
  864. var self=this;
  865. var x;
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. return $core.withContext(function($ctx1) {
  868. //>>excludeEnd("ctx");
  869. var $1;
  870. self["@flag"]="bad";
  871. self._timeout_((10));
  872. x=(0);
  873. $1=self._async_((function(){
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. return $core.withContext(function($ctx2) {
  876. //>>excludeEnd("ctx");
  877. self._finished();
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. $ctx2.sendIdx["finished"]=1;
  880. //>>excludeEnd("ctx");
  881. self["@flag"]="ok";
  882. self["@flag"];
  883. x=$recv(x).__plus((1));
  884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  885. $ctx2.sendIdx["+"]=1;
  886. //>>excludeEnd("ctx");
  887. x;
  888. return self._assert_equals_(x,(1));
  889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  890. $ctx2.sendIdx["assert:equals:"]=1;
  891. //>>excludeEnd("ctx");
  892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  894. //>>excludeEnd("ctx");
  895. }));
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. $ctx1.sendIdx["async:"]=1;
  898. //>>excludeEnd("ctx");
  899. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  901. $ctx1.sendIdx["valueWithTimeout:"]=1;
  902. //>>excludeEnd("ctx");
  903. self["@flag"]=$recv(self._async_((function(){
  904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  905. return $core.withContext(function($ctx2) {
  906. //>>excludeEnd("ctx");
  907. self._finished();
  908. self["@flag"]="ok";
  909. self["@flag"];
  910. x=$recv(x).__plus((1));
  911. x;
  912. return self._assert_equals_(x,(1));
  913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  915. //>>excludeEnd("ctx");
  916. })))._valueWithTimeout_((0));
  917. return self;
  918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  919. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  920. //>>excludeEnd("ctx");
  921. },
  922. //>>excludeStart("ide", pragmas.excludeIdeData);
  923. args: [],
  924. source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09x := 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.",
  925. referencedClasses: [],
  926. //>>excludeEnd("ide");
  927. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  928. }),
  929. $globals.SUnitAsyncTest);
  930. });