Helios-SUnit-Tests.js 25 KB

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