1
0

Helios-SUnit-Tests.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. define("helios/Helios-SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Helios-SUnit-Tests');
  4. $core.packages["Helios-SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Helios-SUnit-Tests"].transport = {"type":"amd","amdNamespace":"helios"};
  6. $core.addClass('HLSUnitModelTest', $globals.TestCase, ['model'], 'Helios-SUnit-Tests');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.HLSUnitModelTest.comment="Test cases for the functionality of `HLSUnitModel`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "setUp",
  13. protocol: 'initializing',
  14. fn: function (){
  15. var self=this;
  16. function $HLSUnitModel(){return $globals.HLSUnitModel||(typeof HLSUnitModel=="undefined"?nil:HLSUnitModel)}
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. (
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. $ctx1.supercall = true,
  23. //>>excludeEnd("ctx");
  24. $globals.HLSUnitModelTest.superclass.fn.prototype._setUp.apply($recv(self), []));
  25. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26. $ctx1.supercall = false;
  27. //>>excludeEnd("ctx");;
  28. self["@model"]=$recv($HLSUnitModel())._new();
  29. return self;
  30. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.HLSUnitModelTest)});
  32. //>>excludeEnd("ctx");
  33. },
  34. //>>excludeStart("ide", pragmas.excludeIdeData);
  35. args: [],
  36. source: "setUp\x0a\x09super setUp.\x0a\x09model := HLSUnitModel new",
  37. referencedClasses: ["HLSUnitModel"],
  38. //>>excludeEnd("ide");
  39. messageSends: ["setUp", "new"]
  40. }),
  41. $globals.HLSUnitModelTest);
  42. $core.addMethod(
  43. $core.method({
  44. selector: "testClassBecomesAvailable",
  45. protocol: 'tests',
  46. fn: function (){
  47. var self=this;
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. return $core.withContext(function($ctx1) {
  50. //>>excludeEnd("ctx");
  51. var $2,$1;
  52. $2=$recv(self["@model"])._testClasses();
  53. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54. $ctx1.sendIdx["testClasses"]=1;
  55. //>>excludeEnd("ctx");
  56. $1=$recv($2)._isEmpty();
  57. self._assert_($1);
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. $ctx1.sendIdx["assert:"]=1;
  60. //>>excludeEnd("ctx");
  61. $recv(self["@model"])._selectPackage_(self._thisPackage());
  62. self._assert_($recv($recv(self["@model"])._testClasses())._includes_(self._class()));
  63. return self;
  64. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65. }, function($ctx1) {$ctx1.fill(self,"testClassBecomesAvailable",{},$globals.HLSUnitModelTest)});
  66. //>>excludeEnd("ctx");
  67. },
  68. //>>excludeStart("ide", pragmas.excludeIdeData);
  69. args: [],
  70. source: "testClassBecomesAvailable\x0a\x09self assert: model testClasses isEmpty.\x0a\x09model selectPackage: self thisPackage.\x0a\x09self assert: (model testClasses includes: self class).",
  71. referencedClasses: [],
  72. //>>excludeEnd("ide");
  73. messageSends: ["assert:", "isEmpty", "testClasses", "selectPackage:", "thisPackage", "includes:", "class"]
  74. }),
  75. $globals.HLSUnitModelTest);
  76. $core.addMethod(
  77. $core.method({
  78. selector: "testEmptyTestResults",
  79. protocol: 'tests',
  80. fn: function (){
  81. var self=this;
  82. function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  83. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  84. return $core.withContext(function($ctx1) {
  85. //>>excludeEnd("ctx");
  86. self._assert_($recv($recv(self["@model"])._testResult())._isKindOf_($TestResult()));
  87. return self;
  88. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  89. }, function($ctx1) {$ctx1.fill(self,"testEmptyTestResults",{},$globals.HLSUnitModelTest)});
  90. //>>excludeEnd("ctx");
  91. },
  92. //>>excludeStart("ide", pragmas.excludeIdeData);
  93. args: [],
  94. source: "testEmptyTestResults\x0a\x09self assert: (model testResult isKindOf: TestResult)",
  95. referencedClasses: ["TestResult"],
  96. //>>excludeEnd("ide");
  97. messageSends: ["assert:", "isKindOf:", "testResult"]
  98. }),
  99. $globals.HLSUnitModelTest);
  100. $core.addMethod(
  101. $core.method({
  102. selector: "testInvertSelectedClasses",
  103. protocol: 'tests',
  104. fn: function (){
  105. var self=this;
  106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  107. return $core.withContext(function($ctx1) {
  108. //>>excludeEnd("ctx");
  109. var $1,$2,$4,$3,$6,$5,$8,$7,$10,$9;
  110. $recv(self["@model"])._selectAllPackages();
  111. $recv(self["@model"])._selectAllClasses();
  112. $1=self["@model"];
  113. $2=self._class();
  114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  115. $ctx1.sendIdx["class"]=1;
  116. //>>excludeEnd("ctx");
  117. $recv($1)._unselectClass_($2);
  118. $4=$recv(self["@model"])._selectedClasses();
  119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  120. $ctx1.sendIdx["selectedClasses"]=1;
  121. //>>excludeEnd("ctx");
  122. $3=$recv($4)._notEmpty();
  123. self._assert_($3);
  124. $6=$recv(self["@model"])._selectedClasses();
  125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  126. $ctx1.sendIdx["selectedClasses"]=2;
  127. //>>excludeEnd("ctx");
  128. $5=$recv($6)._size();
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. $ctx1.sendIdx["size"]=1;
  131. //>>excludeEnd("ctx");
  132. $8=$recv($recv(self["@model"])._testClasses())._size();
  133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  134. $ctx1.sendIdx["size"]=2;
  135. //>>excludeEnd("ctx");
  136. $7=$recv($8).__minus((1));
  137. self._assert_equals_($5,$7);
  138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  139. $ctx1.sendIdx["assert:equals:"]=1;
  140. //>>excludeEnd("ctx");
  141. $recv(self["@model"])._invertSelectedClasses();
  142. $10=$recv(self["@model"])._selectedClasses();
  143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  144. $ctx1.sendIdx["selectedClasses"]=3;
  145. //>>excludeEnd("ctx");
  146. $9=$recv($10)._size();
  147. self._assert_equals_($9,(1));
  148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  149. $ctx1.sendIdx["assert:equals:"]=2;
  150. //>>excludeEnd("ctx");
  151. self._assert_equals_($recv($recv(self["@model"])._selectedClasses())._anyOne(),self._class());
  152. return self;
  153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  154. }, function($ctx1) {$ctx1.fill(self,"testInvertSelectedClasses",{},$globals.HLSUnitModelTest)});
  155. //>>excludeEnd("ctx");
  156. },
  157. //>>excludeStart("ide", pragmas.excludeIdeData);
  158. args: [],
  159. source: "testInvertSelectedClasses\x0a\x09model selectAllPackages.\x0a\x09model selectAllClasses.\x0a\x09model unselectClass: self class.\x0a\x09self assert: model selectedClasses notEmpty.\x0a\x09self assert: model selectedClasses size equals: model testClasses size - 1.\x0a\x09model invertSelectedClasses.\x0a\x09self assert: model selectedClasses size equals: 1.\x0a\x09self assert: model selectedClasses anyOne equals: self class.",
  160. referencedClasses: [],
  161. //>>excludeEnd("ide");
  162. messageSends: ["selectAllPackages", "selectAllClasses", "unselectClass:", "class", "assert:", "notEmpty", "selectedClasses", "assert:equals:", "size", "-", "testClasses", "invertSelectedClasses", "anyOne"]
  163. }),
  164. $globals.HLSUnitModelTest);
  165. $core.addMethod(
  166. $core.method({
  167. selector: "testInvertSelectedPackages",
  168. protocol: 'tests',
  169. fn: function (){
  170. var self=this;
  171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  172. return $core.withContext(function($ctx1) {
  173. //>>excludeEnd("ctx");
  174. var $1,$2,$4,$3,$6,$5,$8,$7,$10,$9;
  175. $recv(self["@model"])._selectAllPackages();
  176. $1=self["@model"];
  177. $2=self._thisPackage();
  178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  179. $ctx1.sendIdx["thisPackage"]=1;
  180. //>>excludeEnd("ctx");
  181. $recv($1)._unselectPackage_($2);
  182. $4=$recv(self["@model"])._selectedPackages();
  183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  184. $ctx1.sendIdx["selectedPackages"]=1;
  185. //>>excludeEnd("ctx");
  186. $3=$recv($4)._notEmpty();
  187. self._assert_($3);
  188. $6=$recv(self["@model"])._selectedPackages();
  189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  190. $ctx1.sendIdx["selectedPackages"]=2;
  191. //>>excludeEnd("ctx");
  192. $5=$recv($6)._size();
  193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  194. $ctx1.sendIdx["size"]=1;
  195. //>>excludeEnd("ctx");
  196. $8=$recv($recv(self["@model"])._testPackages())._size();
  197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  198. $ctx1.sendIdx["size"]=2;
  199. //>>excludeEnd("ctx");
  200. $7=$recv($8).__minus((1));
  201. self._assert_equals_($5,$7);
  202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  203. $ctx1.sendIdx["assert:equals:"]=1;
  204. //>>excludeEnd("ctx");
  205. $recv(self["@model"])._invertSelectedPackages();
  206. $10=$recv(self["@model"])._selectedPackages();
  207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  208. $ctx1.sendIdx["selectedPackages"]=3;
  209. //>>excludeEnd("ctx");
  210. $9=$recv($10)._size();
  211. self._assert_equals_($9,(1));
  212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  213. $ctx1.sendIdx["assert:equals:"]=2;
  214. //>>excludeEnd("ctx");
  215. self._assert_equals_($recv($recv(self["@model"])._selectedPackages())._anyOne(),self._thisPackage());
  216. return self;
  217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  218. }, function($ctx1) {$ctx1.fill(self,"testInvertSelectedPackages",{},$globals.HLSUnitModelTest)});
  219. //>>excludeEnd("ctx");
  220. },
  221. //>>excludeStart("ide", pragmas.excludeIdeData);
  222. args: [],
  223. source: "testInvertSelectedPackages\x0a\x09model selectAllPackages.\x0a\x09model unselectPackage: self thisPackage.\x0a\x09self assert: model selectedPackages notEmpty.\x0a\x09self assert: model selectedPackages size equals: model testPackages size - 1.\x0a\x09model invertSelectedPackages.\x0a\x09self assert: model selectedPackages size equals: 1.\x0a\x09self assert: model selectedPackages anyOne equals: self thisPackage.",
  224. referencedClasses: [],
  225. //>>excludeEnd("ide");
  226. messageSends: ["selectAllPackages", "unselectPackage:", "thisPackage", "assert:", "notEmpty", "selectedPackages", "assert:equals:", "size", "-", "testPackages", "invertSelectedPackages", "anyOne"]
  227. }),
  228. $globals.HLSUnitModelTest);
  229. $core.addMethod(
  230. $core.method({
  231. selector: "testSelectAllClasses",
  232. protocol: 'tests',
  233. fn: function (){
  234. var self=this;
  235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  236. return $core.withContext(function($ctx1) {
  237. //>>excludeEnd("ctx");
  238. var $2,$1,$3;
  239. $recv(self["@model"])._selectAllPackages();
  240. $2=$recv(self["@model"])._testClasses();
  241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  242. $ctx1.sendIdx["testClasses"]=1;
  243. //>>excludeEnd("ctx");
  244. $1=$recv($2)._notEmpty();
  245. self._assert_($1);
  246. $recv(self["@model"])._selectAllClasses();
  247. $3=$recv($recv(self["@model"])._selectedClasses())._size();
  248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  249. $ctx1.sendIdx["size"]=1;
  250. //>>excludeEnd("ctx");
  251. self._assert_equals_($3,$recv($recv(self["@model"])._testClasses())._size());
  252. return self;
  253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  254. }, function($ctx1) {$ctx1.fill(self,"testSelectAllClasses",{},$globals.HLSUnitModelTest)});
  255. //>>excludeEnd("ctx");
  256. },
  257. //>>excludeStart("ide", pragmas.excludeIdeData);
  258. args: [],
  259. source: "testSelectAllClasses\x0a\x09model selectAllPackages.\x0a\x09self assert: model testClasses notEmpty.\x0a\x09model selectAllClasses.\x0a\x09self assert: model selectedClasses size equals: model testClasses size",
  260. referencedClasses: [],
  261. //>>excludeEnd("ide");
  262. messageSends: ["selectAllPackages", "assert:", "notEmpty", "testClasses", "selectAllClasses", "assert:equals:", "size", "selectedClasses"]
  263. }),
  264. $globals.HLSUnitModelTest);
  265. $core.addMethod(
  266. $core.method({
  267. selector: "testSelectAllPackages",
  268. protocol: 'tests',
  269. fn: function (){
  270. var self=this;
  271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  272. return $core.withContext(function($ctx1) {
  273. //>>excludeEnd("ctx");
  274. var $2,$1,$3;
  275. $2=$recv(self["@model"])._selectedPackages();
  276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  277. $ctx1.sendIdx["selectedPackages"]=1;
  278. //>>excludeEnd("ctx");
  279. $1=$recv($2)._isEmpty();
  280. self._assert_($1);
  281. $recv(self["@model"])._selectAllPackages();
  282. $3=$recv($recv(self["@model"])._selectedPackages())._size();
  283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  284. $ctx1.sendIdx["size"]=1;
  285. //>>excludeEnd("ctx");
  286. self._assert_equals_($3,$recv($recv(self["@model"])._testPackages())._size());
  287. return self;
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. }, function($ctx1) {$ctx1.fill(self,"testSelectAllPackages",{},$globals.HLSUnitModelTest)});
  290. //>>excludeEnd("ctx");
  291. },
  292. //>>excludeStart("ide", pragmas.excludeIdeData);
  293. args: [],
  294. source: "testSelectAllPackages\x0a\x09self assert: model selectedPackages isEmpty.\x0a\x09model selectAllPackages.\x0a\x09self assert: model selectedPackages size equals: model testPackages size",
  295. referencedClasses: [],
  296. //>>excludeEnd("ide");
  297. messageSends: ["assert:", "isEmpty", "selectedPackages", "selectAllPackages", "assert:equals:", "size", "testPackages"]
  298. }),
  299. $globals.HLSUnitModelTest);
  300. $core.addMethod(
  301. $core.method({
  302. selector: "testSelectClass",
  303. protocol: 'tests',
  304. fn: function (){
  305. var self=this;
  306. var announcementFired;
  307. function $HLClassSelected(){return $globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
  308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  309. return $core.withContext(function($ctx1) {
  310. //>>excludeEnd("ctx");
  311. var $2,$1,$3,$4;
  312. $recv(self["@model"])._selectPackage_(self._thisPackage());
  313. $2=$recv(self["@model"])._selectedClasses();
  314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  315. $ctx1.sendIdx["selectedClasses"]=1;
  316. //>>excludeEnd("ctx");
  317. $1=$recv($2)._isEmpty();
  318. self._assert_($1);
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. $ctx1.sendIdx["assert:"]=1;
  321. //>>excludeEnd("ctx");
  322. $recv($recv(self["@model"])._announcer())._on_do_for_($HLClassSelected(),(function(){
  323. announcementFired=true;
  324. return announcementFired;
  325. }),self);
  326. $3=self["@model"];
  327. $4=self._class();
  328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  329. $ctx1.sendIdx["class"]=1;
  330. //>>excludeEnd("ctx");
  331. $recv($3)._selectClass_($4);
  332. self._assert_equals_($recv($recv(self["@model"])._selectedClasses())._anyOne(),self._class());
  333. self._assert_(announcementFired);
  334. return self;
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. }, function($ctx1) {$ctx1.fill(self,"testSelectClass",{announcementFired:announcementFired},$globals.HLSUnitModelTest)});
  337. //>>excludeEnd("ctx");
  338. },
  339. //>>excludeStart("ide", pragmas.excludeIdeData);
  340. args: [],
  341. source: "testSelectClass\x0a\x09| announcementFired |\x0a\x09model selectPackage: self thisPackage.\x0a\x09self assert: model selectedClasses isEmpty.\x0a\x09model announcer on: HLClassSelected\x0a\x09\x09do: [ announcementFired := true ]\x0a\x09\x09for: self.\x0a\x09model selectClass: self class.\x0a\x09self assert: model selectedClasses anyOne equals: self class.\x0a\x09self assert: announcementFired.",
  342. referencedClasses: ["HLClassSelected"],
  343. //>>excludeEnd("ide");
  344. messageSends: ["selectPackage:", "thisPackage", "assert:", "isEmpty", "selectedClasses", "on:do:for:", "announcer", "selectClass:", "class", "assert:equals:", "anyOne"]
  345. }),
  346. $globals.HLSUnitModelTest);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "testSelectPackage",
  350. protocol: 'tests',
  351. fn: function (){
  352. var self=this;
  353. var announcementFired;
  354. function $HLPackageSelected(){return $globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
  355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  356. return $core.withContext(function($ctx1) {
  357. //>>excludeEnd("ctx");
  358. var $2,$1,$3,$4;
  359. $2=$recv(self["@model"])._selectedPackages();
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. $ctx1.sendIdx["selectedPackages"]=1;
  362. //>>excludeEnd("ctx");
  363. $1=$recv($2)._isEmpty();
  364. self._assert_($1);
  365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  366. $ctx1.sendIdx["assert:"]=1;
  367. //>>excludeEnd("ctx");
  368. $recv($recv(self["@model"])._announcer())._on_do_for_($HLPackageSelected(),(function(){
  369. announcementFired=true;
  370. return announcementFired;
  371. }),self);
  372. $3=self["@model"];
  373. $4=self._thisPackage();
  374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  375. $ctx1.sendIdx["thisPackage"]=1;
  376. //>>excludeEnd("ctx");
  377. $recv($3)._selectPackage_($4);
  378. self._assert_equals_($recv($recv(self["@model"])._selectedPackages())._anyOne(),self._thisPackage());
  379. self._assert_(announcementFired);
  380. return self;
  381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  382. }, function($ctx1) {$ctx1.fill(self,"testSelectPackage",{announcementFired:announcementFired},$globals.HLSUnitModelTest)});
  383. //>>excludeEnd("ctx");
  384. },
  385. //>>excludeStart("ide", pragmas.excludeIdeData);
  386. args: [],
  387. source: "testSelectPackage\x0a\x09| announcementFired |\x0a\x09self assert: model selectedPackages isEmpty.\x0a\x09model announcer on: HLPackageSelected\x0a\x09\x09do: [ announcementFired := true ]\x0a\x09\x09for: self.\x0a\x09model selectPackage: self thisPackage.\x0a\x09self assert: model selectedPackages anyOne equals: self thisPackage.\x0a\x09self assert: announcementFired",
  388. referencedClasses: ["HLPackageSelected"],
  389. //>>excludeEnd("ide");
  390. messageSends: ["assert:", "isEmpty", "selectedPackages", "on:do:for:", "announcer", "selectPackage:", "thisPackage", "assert:equals:", "anyOne"]
  391. }),
  392. $globals.HLSUnitModelTest);
  393. $core.addMethod(
  394. $core.method({
  395. selector: "testSelectedClassNotListedIfPackageUnselected",
  396. protocol: 'tests',
  397. fn: function (){
  398. var self=this;
  399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  400. return $core.withContext(function($ctx1) {
  401. //>>excludeEnd("ctx");
  402. var $1,$2,$3,$4,$6,$5;
  403. $1=self["@model"];
  404. $2=self._thisPackage();
  405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  406. $ctx1.sendIdx["thisPackage"]=1;
  407. //>>excludeEnd("ctx");
  408. $recv($1)._selectPackage_($2);
  409. $3=self["@model"];
  410. $4=self._class();
  411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  412. $ctx1.sendIdx["class"]=1;
  413. //>>excludeEnd("ctx");
  414. $recv($3)._selectClass_($4);
  415. $6=$recv(self["@model"])._selectedClasses();
  416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  417. $ctx1.sendIdx["selectedClasses"]=1;
  418. //>>excludeEnd("ctx");
  419. $5=$recv($6)._anyOne();
  420. self._assert_equals_($5,self._class());
  421. $recv(self["@model"])._unselectPackage_(self._thisPackage());
  422. self._assert_($recv($recv(self["@model"])._selectedClasses())._isEmpty());
  423. return self;
  424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  425. }, function($ctx1) {$ctx1.fill(self,"testSelectedClassNotListedIfPackageUnselected",{},$globals.HLSUnitModelTest)});
  426. //>>excludeEnd("ctx");
  427. },
  428. //>>excludeStart("ide", pragmas.excludeIdeData);
  429. args: [],
  430. source: "testSelectedClassNotListedIfPackageUnselected\x0a\x09model selectPackage: self thisPackage.\x0a\x09model selectClass: self class.\x0a\x09self assert: model selectedClasses anyOne equals: self class.\x0a\x09model unselectPackage: self thisPackage.\x0a\x09self assert: model selectedClasses isEmpty.",
  431. referencedClasses: [],
  432. //>>excludeEnd("ide");
  433. messageSends: ["selectPackage:", "thisPackage", "selectClass:", "class", "assert:equals:", "anyOne", "selectedClasses", "unselectPackage:", "assert:", "isEmpty"]
  434. }),
  435. $globals.HLSUnitModelTest);
  436. $core.addMethod(
  437. $core.method({
  438. selector: "testTestClassHasOnlyTestClasses",
  439. protocol: 'tests',
  440. fn: function (){
  441. var self=this;
  442. var notATestClass;
  443. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  444. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  446. return $core.withContext(function($ctx1) {
  447. //>>excludeEnd("ctx");
  448. notATestClass=$recv($Object())._subclass_instanceVariableNames_package_("HLNotATestClass","",$recv(self._class())._category());
  449. $recv(self["@model"])._selectPackage_(self._thisPackage());
  450. self._deny_($recv($recv(self["@model"])._testClasses())._includes_(notATestClass));
  451. $recv($Smalltalk())._removeClass_(notATestClass);
  452. return self;
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. }, function($ctx1) {$ctx1.fill(self,"testTestClassHasOnlyTestClasses",{notATestClass:notATestClass},$globals.HLSUnitModelTest)});
  455. //>>excludeEnd("ctx");
  456. },
  457. //>>excludeStart("ide", pragmas.excludeIdeData);
  458. args: [],
  459. source: "testTestClassHasOnlyTestClasses\x0a\x09| notATestClass |\x0a\x09notATestClass := Object subclass: #HLNotATestClass\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: self class category.\x0a\x09model selectPackage: self thisPackage.\x0a\x09self deny: (model testClasses includes: notATestClass).\x0a\x09Smalltalk removeClass: notATestClass.",
  460. referencedClasses: ["Object", "Smalltalk"],
  461. //>>excludeEnd("ide");
  462. messageSends: ["subclass:instanceVariableNames:package:", "category", "class", "selectPackage:", "thisPackage", "deny:", "includes:", "testClasses", "removeClass:"]
  463. }),
  464. $globals.HLSUnitModelTest);
  465. $core.addMethod(
  466. $core.method({
  467. selector: "testTestPackages",
  468. protocol: 'tests',
  469. fn: function (){
  470. var self=this;
  471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  472. return $core.withContext(function($ctx1) {
  473. //>>excludeEnd("ctx");
  474. var $2,$1;
  475. $2=$recv(self["@model"])._testPackages();
  476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  477. $ctx1.sendIdx["testPackages"]=1;
  478. //>>excludeEnd("ctx");
  479. $1=$recv($2)._notEmpty();
  480. self._assert_($1);
  481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  482. $ctx1.sendIdx["assert:"]=1;
  483. //>>excludeEnd("ctx");
  484. self._assert_($recv($recv(self["@model"])._testPackages())._anySatisfy_((function(each){
  485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  486. return $core.withContext(function($ctx2) {
  487. //>>excludeEnd("ctx");
  488. return $recv(each).__eq(self._thisPackage());
  489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  491. //>>excludeEnd("ctx");
  492. })));
  493. return self;
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. }, function($ctx1) {$ctx1.fill(self,"testTestPackages",{},$globals.HLSUnitModelTest)});
  496. //>>excludeEnd("ctx");
  497. },
  498. //>>excludeStart("ide", pragmas.excludeIdeData);
  499. args: [],
  500. source: "testTestPackages\x0a\x09self assert: model testPackages notEmpty.\x0a\x09self assert: (model testPackages anySatisfy: [:each | each = self thisPackage]).",
  501. referencedClasses: [],
  502. //>>excludeEnd("ide");
  503. messageSends: ["assert:", "notEmpty", "testPackages", "anySatisfy:", "=", "thisPackage"]
  504. }),
  505. $globals.HLSUnitModelTest);
  506. $core.addMethod(
  507. $core.method({
  508. selector: "testUnselectClass",
  509. protocol: 'tests',
  510. fn: function (){
  511. var self=this;
  512. var announcementFired;
  513. function $HLClassUnselected(){return $globals.HLClassUnselected||(typeof HLClassUnselected=="undefined"?nil:HLClassUnselected)}
  514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  515. return $core.withContext(function($ctx1) {
  516. //>>excludeEnd("ctx");
  517. var $1,$2;
  518. $recv(self["@model"])._selectPackage_(self._thisPackage());
  519. $1=self["@model"];
  520. $2=self._class();
  521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  522. $ctx1.sendIdx["class"]=1;
  523. //>>excludeEnd("ctx");
  524. $recv($1)._selectClass_($2);
  525. $recv($recv(self["@model"])._announcer())._on_do_for_($HLClassUnselected(),(function(){
  526. announcementFired=true;
  527. return announcementFired;
  528. }),self);
  529. $recv(self["@model"])._unselectClass_(self._class());
  530. self._assert_($recv($recv(self["@model"])._selectedClasses())._isEmpty());
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. $ctx1.sendIdx["assert:"]=1;
  533. //>>excludeEnd("ctx");
  534. self._assert_(announcementFired);
  535. return self;
  536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  537. }, function($ctx1) {$ctx1.fill(self,"testUnselectClass",{announcementFired:announcementFired},$globals.HLSUnitModelTest)});
  538. //>>excludeEnd("ctx");
  539. },
  540. //>>excludeStart("ide", pragmas.excludeIdeData);
  541. args: [],
  542. source: "testUnselectClass\x0a\x09| announcementFired |\x0a\x09model selectPackage: self thisPackage.\x0a\x09model selectClass: self class.\x0a\x09model announcer on: HLClassUnselected\x0a\x09\x09do: [ announcementFired := true ]\x0a\x09\x09for: self.\x0a\x09model unselectClass: self class.\x0a\x09self assert: model selectedClasses isEmpty.\x0a\x09self assert: announcementFired",
  543. referencedClasses: ["HLClassUnselected"],
  544. //>>excludeEnd("ide");
  545. messageSends: ["selectPackage:", "thisPackage", "selectClass:", "class", "on:do:for:", "announcer", "unselectClass:", "assert:", "isEmpty", "selectedClasses"]
  546. }),
  547. $globals.HLSUnitModelTest);
  548. $core.addMethod(
  549. $core.method({
  550. selector: "testUnselectPackage",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. var announcementFired;
  555. function $HLPackageUnselected(){return $globals.HLPackageUnselected||(typeof HLPackageUnselected=="undefined"?nil:HLPackageUnselected)}
  556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  557. return $core.withContext(function($ctx1) {
  558. //>>excludeEnd("ctx");
  559. var $1,$2;
  560. $1=self["@model"];
  561. $2=self._thisPackage();
  562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  563. $ctx1.sendIdx["thisPackage"]=1;
  564. //>>excludeEnd("ctx");
  565. $recv($1)._selectPackage_($2);
  566. $recv($recv(self["@model"])._announcer())._on_do_for_($HLPackageUnselected(),(function(){
  567. announcementFired=true;
  568. return announcementFired;
  569. }),self);
  570. $recv(self["@model"])._unselectPackage_(self._thisPackage());
  571. self._assert_($recv($recv(self["@model"])._selectedPackages())._isEmpty());
  572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  573. $ctx1.sendIdx["assert:"]=1;
  574. //>>excludeEnd("ctx");
  575. self._assert_(announcementFired);
  576. return self;
  577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  578. }, function($ctx1) {$ctx1.fill(self,"testUnselectPackage",{announcementFired:announcementFired},$globals.HLSUnitModelTest)});
  579. //>>excludeEnd("ctx");
  580. },
  581. //>>excludeStart("ide", pragmas.excludeIdeData);
  582. args: [],
  583. source: "testUnselectPackage\x0a\x09| announcementFired |\x0a\x09model selectPackage: self thisPackage.\x0a\x09model announcer on: HLPackageUnselected\x0a\x09\x09do: [ announcementFired := true ]\x0a\x09\x09for: self.\x0a\x09model unselectPackage: self thisPackage.\x0a\x09self assert: model selectedPackages isEmpty.\x0a\x09self assert: announcementFired.",
  584. referencedClasses: ["HLPackageUnselected"],
  585. //>>excludeEnd("ide");
  586. messageSends: ["selectPackage:", "thisPackage", "on:do:for:", "announcer", "unselectPackage:", "assert:", "isEmpty", "selectedPackages"]
  587. }),
  588. $globals.HLSUnitModelTest);
  589. $core.addMethod(
  590. $core.method({
  591. selector: "thisPackage",
  592. protocol: 'accessing',
  593. fn: function (){
  594. var self=this;
  595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  596. return $core.withContext(function($ctx1) {
  597. //>>excludeEnd("ctx");
  598. var $1;
  599. $1=$recv(self._class())._package();
  600. return $1;
  601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  602. }, function($ctx1) {$ctx1.fill(self,"thisPackage",{},$globals.HLSUnitModelTest)});
  603. //>>excludeEnd("ctx");
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: [],
  607. source: "thisPackage\x0a\x09^self class package",
  608. referencedClasses: [],
  609. //>>excludeEnd("ide");
  610. messageSends: ["package", "class"]
  611. }),
  612. $globals.HLSUnitModelTest);
  613. });