Helios-SUnit-Tests.js 25 KB

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