1
0

Kernel-Tests.deploy.js 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCompiledSource",
  5. smalltalk.method({
  6. selector: "testCompiledSource",
  7. fn: function () {
  8. var self = this;
  9. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(function () {return smalltalk.send(1, "__plus", [1]);}, "_compiledSource", []), "_includesSubString_", ["function"])]);
  10. return self;
  11. }
  12. }),
  13. smalltalk.BlockClosureTest);
  14. smalltalk.addMethod(
  15. "_testEnsure",
  16. smalltalk.method({
  17. selector: "testEnsure",
  18. fn: function () {
  19. var self = this;
  20. smalltalk.send(self, "_assert_", [smalltalk.send(function () {return smalltalk.send(smalltalk.Error || Error, "_new", []);}, "_ensure_", [function () {return true;}])]);
  21. return self;
  22. }
  23. }),
  24. smalltalk.BlockClosureTest);
  25. smalltalk.addMethod(
  26. "_testNumArgs",
  27. smalltalk.method({
  28. selector: "testNumArgs",
  29. fn: function () {
  30. var self = this;
  31. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function () {}, "_numArgs", []), 0]);
  32. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a, b) {}, "_numArgs", []), 2]);
  33. return self;
  34. }
  35. }),
  36. smalltalk.BlockClosureTest);
  37. smalltalk.addMethod(
  38. "_testOnDo",
  39. smalltalk.method({
  40. selector: "testOnDo",
  41. fn: function () {
  42. var self = this;
  43. smalltalk.send(self, "_assert_", [smalltalk.send(function () {return smalltalk.send(smalltalk.send(smalltalk.Error || Error, "_new", []), "_signal", []);}, "_on_do_", [smalltalk.Error || Error, function (ex) {return true;}])]);
  44. return self;
  45. }
  46. }),
  47. smalltalk.BlockClosureTest);
  48. smalltalk.addMethod(
  49. "_testValue",
  50. smalltalk.method({
  51. selector: "testValue",
  52. fn: function () {
  53. var self = this;
  54. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function () {return smalltalk.send(1, "__plus", [1]);}, "_value", []), 2]);
  55. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (x) {return smalltalk.send(x, "__plus", [1]);}, "_value_", [2]), 3]);
  56. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (x, y) {return smalltalk.send(x, "__star", [y]);}, "_value_value_", [2, 4]), 8]);
  57. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a, b, c) {return 1;}, "_value", []), 1]);
  58. return self;
  59. }
  60. }),
  61. smalltalk.BlockClosureTest);
  62. smalltalk.addMethod(
  63. "_testValueWithPossibleArguments",
  64. smalltalk.method({
  65. selector: "testValueWithPossibleArguments",
  66. fn: function () {
  67. var self = this;
  68. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function () {return 1;}, "_valueWithPossibleArguments_", [[3, 4]]), 1]);
  69. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a) {return smalltalk.send(a, "__plus", [4]);}, "_valueWithPossibleArguments_", [[3, 4]]), 7]);
  70. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a, b) {return smalltalk.send(a, "__plus", [b]);}, "_valueWithPossibleArguments_", [[3, 4, 5]]), 7]);
  71. return self;
  72. }
  73. }),
  74. smalltalk.BlockClosureTest);
  75. smalltalk.addMethod(
  76. "_testWhileFalse",
  77. smalltalk.method({
  78. selector: "testWhileFalse",
  79. fn: function () {
  80. var self = this;
  81. var i;
  82. i = 0;
  83. smalltalk.send(function () {return smalltalk.send(i, "__gt", [5]);}, "_whileFalse_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  84. smalltalk.send(self, "_assert_equals_", [i, 6]);
  85. i = 0;
  86. smalltalk.send(function () {i = smalltalk.send(i, "__plus", [1]);i;return smalltalk.send(i, "__gt", [5]);}, "_whileFalse", []);
  87. smalltalk.send(self, "_assert_equals_", [i, 6]);
  88. return self;
  89. }
  90. }),
  91. smalltalk.BlockClosureTest);
  92. smalltalk.addMethod(
  93. "_testWhileTrue",
  94. smalltalk.method({
  95. selector: "testWhileTrue",
  96. fn: function () {
  97. var self = this;
  98. var i;
  99. i = 0;
  100. smalltalk.send(function () {return smalltalk.send(i, "__lt", [5]);}, "_whileTrue_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  101. smalltalk.send(self, "_assert_equals_", [i, 5]);
  102. i = 0;
  103. smalltalk.send(function () {i = smalltalk.send(i, "__plus", [1]);i;return smalltalk.send(i, "__lt", [5]);}, "_whileTrue", []);
  104. smalltalk.send(self, "_assert_equals_", [i, 5]);
  105. return self;
  106. }
  107. }),
  108. smalltalk.BlockClosureTest);
  109. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  110. smalltalk.addMethod(
  111. "_testEquality",
  112. smalltalk.method({
  113. selector: "testEquality",
  114. fn: function () {
  115. var self = this;
  116. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq", [false])]);
  117. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [0])]);
  118. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  119. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  120. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  121. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  122. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  123. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  124. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  125. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  126. return self;
  127. }
  128. }),
  129. smalltalk.BooleanTest);
  130. smalltalk.addMethod(
  131. "_testIdentity",
  132. smalltalk.method({
  133. selector: "testIdentity",
  134. fn: function () {
  135. var self = this;
  136. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq_eq", [false])]);
  137. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [0])]);
  138. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [false])]);
  139. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [""])]);
  140. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  141. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [true])]);
  142. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  143. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq_eq", [false])]);
  144. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  145. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  146. return self;
  147. }
  148. }),
  149. smalltalk.BooleanTest);
  150. smalltalk.addMethod(
  151. "_testIfTrueIfFalse",
  152. smalltalk.method({
  153. selector: "testIfTrueIfFalse",
  154. fn: function () {
  155. var self = this;
  156. var $1, $2, $3, $4, $5, $6, $7, $8;
  157. if (smalltalk.assert(true)) {
  158. $1 = "alternative block";
  159. }
  160. smalltalk.send(self, "_assert_", [smalltalk.send($1, "__eq", ["alternative block"])]);
  161. if (!smalltalk.assert(true)) {
  162. $2 = "alternative block";
  163. }
  164. smalltalk.send(self, "_assert_", [smalltalk.send($2, "__eq", [nil])]);
  165. if (smalltalk.assert(false)) {
  166. $3 = "alternative block";
  167. }
  168. smalltalk.send(self, "_assert_", [smalltalk.send($3, "__eq", [nil])]);
  169. if (!smalltalk.assert(false)) {
  170. $4 = "alternative block";
  171. }
  172. smalltalk.send(self, "_assert_", [smalltalk.send($4, "__eq", ["alternative block"])]);
  173. if (smalltalk.assert(false)) {
  174. $5 = "alternative block";
  175. } else {
  176. $5 = "alternative block2";
  177. }
  178. smalltalk.send(self, "_assert_", [smalltalk.send($5, "__eq", ["alternative block2"])]);
  179. if (smalltalk.assert(false)) {
  180. $6 = "alternative block2";
  181. } else {
  182. $6 = "alternative block";
  183. }
  184. smalltalk.send(self, "_assert_", [smalltalk.send($6, "__eq", ["alternative block"])]);
  185. if (smalltalk.assert(true)) {
  186. $7 = "alternative block";
  187. } else {
  188. $7 = "alternative block2";
  189. }
  190. smalltalk.send(self, "_assert_", [smalltalk.send($7, "__eq", ["alternative block"])]);
  191. if (smalltalk.assert(true)) {
  192. $8 = "alternative block2";
  193. } else {
  194. $8 = "alternative block";
  195. }
  196. smalltalk.send(self, "_assert_", [smalltalk.send($8, "__eq", ["alternative block2"])]);
  197. return self;
  198. }
  199. }),
  200. smalltalk.BooleanTest);
  201. smalltalk.addMethod(
  202. "_testLogic",
  203. smalltalk.method({
  204. selector: "testLogic",
  205. fn: function () {
  206. var self = this;
  207. var $1, $2, $3, $4;
  208. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_&", [true])]);
  209. smalltalk.send(self, "_deny_", [smalltalk.send(true, "_&", [false])]);
  210. smalltalk.send(self, "_deny_", [smalltalk.send(false, "_&", [true])]);
  211. $1 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_&", [false])]);
  212. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_|", [true])]);
  213. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_|", [false])]);
  214. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_|", [true])]);
  215. $2 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_|", [false])]);
  216. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_&", [smalltalk.send(1, "__gt", [0])])]);
  217. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_&", [false])]);
  218. $3 = smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_&", [smalltalk.send(1, "__gt", [2])])]);
  219. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_|", [smalltalk.send(1, "__gt", [0])])]);
  220. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_|", [false])]);
  221. $4 = smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_|", [smalltalk.send(1, "__gt", [2])])]);
  222. return self;
  223. }
  224. }),
  225. smalltalk.BooleanTest);
  226. smalltalk.addMethod(
  227. "_testLogicKeywords",
  228. smalltalk.method({
  229. selector: "testLogicKeywords",
  230. fn: function () {
  231. var self = this;
  232. var $1, $2, $3, $4;
  233. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_and_", [function () {return true;}])]);
  234. smalltalk.send(self, "_deny_", [smalltalk.send(true, "_and_", [function () {return false;}])]);
  235. smalltalk.send(self, "_deny_", [smalltalk.send(false, "_and_", [function () {return true;}])]);
  236. $1 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_and_", [function () {return false;}])]);
  237. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_or_", [function () {return true;}])]);
  238. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_or_", [function () {return false;}])]);
  239. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_or_", [function () {return true;}])]);
  240. $2 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_or_", [function () {return false;}])]);
  241. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_and_", [function () {return smalltalk.send(1, "__gt", [0]);}])]);
  242. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_and_", [function () {return false;}])]);
  243. $3 = smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_and_", [function () {return smalltalk.send(1, "__gt", [2]);}])]);
  244. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_or_", [function () {return smalltalk.send(1, "__gt", [0]);}])]);
  245. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_or_", [function () {return false;}])]);
  246. $4 = smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_or_", [function () {return smalltalk.send(1, "__gt", [2]);}])]);
  247. return self;
  248. }
  249. }),
  250. smalltalk.BooleanTest);
  251. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  252. smalltalk.addMethod(
  253. "_setUp",
  254. smalltalk.method({
  255. selector: "setUp",
  256. fn: function () {
  257. var self = this;
  258. self['@builder'] = smalltalk.send(smalltalk.ClassBuilder || ClassBuilder, "_new", []);
  259. return self;
  260. }
  261. }),
  262. smalltalk.ClassBuilderTest);
  263. smalltalk.addMethod(
  264. "_tearDown",
  265. smalltalk.method({
  266. selector: "tearDown",
  267. fn: function () {
  268. var self = this;
  269. if (($receiver = self['@theClass']) == nil || $receiver == undefined) {
  270. self['@theClass'];
  271. } else {
  272. smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_removeClass_", [self['@theClass']]);
  273. self['@theClass'] = nil;
  274. self['@theClass'];
  275. }
  276. return self;
  277. }
  278. }),
  279. smalltalk.ClassBuilderTest);
  280. smalltalk.addMethod(
  281. "_testClassCopy",
  282. smalltalk.method({
  283. selector: "testClassCopy",
  284. fn: function () {
  285. var self = this;
  286. self['@theClass'] = smalltalk.send(self['@builder'], "_copyClass_named_", [smalltalk.ObjectMock || ObjectMock, "ObjectMock2"]);
  287. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_superclass", [])])]);
  288. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_instanceVariableNames", [])])]);
  289. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  290. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_package", [])])]);
  291. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_methodDictionary", []), "_keys", [])]);
  292. return self;
  293. }
  294. }),
  295. smalltalk.ClassBuilderTest);
  296. smalltalk.addMethod(
  297. "_testInstanceVariableNames",
  298. smalltalk.method({
  299. selector: "testInstanceVariableNames",
  300. fn: function () {
  301. var self = this;
  302. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  303. return self;
  304. }
  305. }),
  306. smalltalk.ClassBuilderTest);
  307. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  308. smalltalk.addMethod(
  309. "_assertSameContents_as_",
  310. smalltalk.method({
  311. selector: "assertSameContents:as:",
  312. fn: function (aCollection, anotherCollection) {
  313. var self = this;
  314. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(aCollection, "_size", []), "__eq", [smalltalk.send(anotherCollection, "_size", [])])]);
  315. smalltalk.send(aCollection, "_do_", [function (each) {return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(aCollection, "_occurrencesOf_", [each]), "__eq", [smalltalk.send(anotherCollection, "_occurrencesOf_", [each])])]);}]);
  316. return self;
  317. }
  318. }),
  319. smalltalk.CollectionTest);
  320. smalltalk.addMethod(
  321. "_collection",
  322. smalltalk.method({
  323. selector: "collection",
  324. fn: function () {
  325. var self = this;
  326. var $1;
  327. $1 = smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_withAll_", [smalltalk.send(self, "_defaultValues", [])]);
  328. return $1;
  329. }
  330. }),
  331. smalltalk.CollectionTest);
  332. smalltalk.addMethod(
  333. "_collectionClass",
  334. smalltalk.method({
  335. selector: "collectionClass",
  336. fn: function () {
  337. var self = this;
  338. var $1;
  339. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_collectionClass", []);
  340. return $1;
  341. }
  342. }),
  343. smalltalk.CollectionTest);
  344. smalltalk.addMethod(
  345. "_collectionWithDuplicates",
  346. smalltalk.method({
  347. selector: "collectionWithDuplicates",
  348. fn: function () {
  349. var self = this;
  350. var $1;
  351. $1 = smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_withAll_", [["a", "b", "c", 1, 2, 1, "a"]]);
  352. return $1;
  353. }
  354. }),
  355. smalltalk.CollectionTest);
  356. smalltalk.addMethod(
  357. "_defaultValues",
  358. smalltalk.method({
  359. selector: "defaultValues",
  360. fn: function () {
  361. var self = this;
  362. return [1, 2, 3, -4];
  363. }
  364. }),
  365. smalltalk.CollectionTest);
  366. smalltalk.addMethod(
  367. "_isCollectionReadOnly",
  368. smalltalk.method({
  369. selector: "isCollectionReadOnly",
  370. fn: function () {
  371. var self = this;
  372. return false;
  373. }
  374. }),
  375. smalltalk.CollectionTest);
  376. smalltalk.addMethod(
  377. "_testAsArray",
  378. smalltalk.method({
  379. selector: "testAsArray",
  380. fn: function () {
  381. var self = this;
  382. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), smalltalk.send(smalltalk.send(self, "_collection", []), "_asArray", [])]);
  383. return self;
  384. }
  385. }),
  386. smalltalk.CollectionTest);
  387. smalltalk.addMethod(
  388. "_testAsOrderedCollection",
  389. smalltalk.method({
  390. selector: "testAsOrderedCollection",
  391. fn: function () {
  392. var self = this;
  393. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), smalltalk.send(smalltalk.send(self, "_collection", []), "_asOrderedCollection", [])]);
  394. return self;
  395. }
  396. }),
  397. smalltalk.CollectionTest);
  398. smalltalk.addMethod(
  399. "_testAsSet",
  400. smalltalk.method({
  401. selector: "testAsSet",
  402. fn: function () {
  403. var self = this;
  404. var c;
  405. var set;
  406. c = smalltalk.send(self, "_collectionWithDuplicates", []);
  407. set = smalltalk.send(c, "_asSet", []);
  408. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [5])]);
  409. smalltalk.send(c, "_do_", [function (each) {return smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [each])]);}]);
  410. return self;
  411. }
  412. }),
  413. smalltalk.CollectionTest);
  414. smalltalk.addMethod(
  415. "_testCollect",
  416. smalltalk.method({
  417. selector: "testCollect",
  418. fn: function () {
  419. var self = this;
  420. var newCollection;
  421. newCollection = [1, 2, 3, 4];
  422. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_collect_", [function (each) {return smalltalk.send(each, "_abs", []);}]), newCollection]);
  423. return self;
  424. }
  425. }),
  426. smalltalk.CollectionTest);
  427. smalltalk.addMethod(
  428. "_testDetect",
  429. smalltalk.method({
  430. selector: "testDetect",
  431. fn: function () {
  432. var self = this;
  433. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__lt", [0]);}]), "__eq", [-4])]);
  434. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", [6]);}]);}, smalltalk.Error || Error]);
  435. return self;
  436. }
  437. }),
  438. smalltalk.CollectionTest);
  439. smalltalk.addMethod(
  440. "_testDo",
  441. smalltalk.method({
  442. selector: "testDo",
  443. fn: function () {
  444. var self = this;
  445. var newCollection;
  446. newCollection = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  447. smalltalk.send(smalltalk.send(self, "_collection", []), "_do_", [function (each) {return smalltalk.send(newCollection, "_add_", [each]);}]);
  448. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), newCollection]);
  449. return self;
  450. }
  451. }),
  452. smalltalk.CollectionTest);
  453. smalltalk.addMethod(
  454. "_testIsEmpty",
  455. smalltalk.method({
  456. selector: "testIsEmpty",
  457. fn: function () {
  458. var self = this;
  459. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_new", []), "_isEmpty", [])]);
  460. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_isEmpty", [])]);
  461. return self;
  462. }
  463. }),
  464. smalltalk.CollectionTest);
  465. smalltalk.addMethod(
  466. "_testSelect",
  467. smalltalk.method({
  468. selector: "testSelect",
  469. fn: function () {
  470. var self = this;
  471. var newCollection;
  472. newCollection = [2, -4];
  473. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_select_", [function (each) {return smalltalk.send(each, "_even", []);}]), newCollection]);
  474. return self;
  475. }
  476. }),
  477. smalltalk.CollectionTest);
  478. smalltalk.addMethod(
  479. "_testSize",
  480. smalltalk.method({
  481. selector: "testSize",
  482. fn: function () {
  483. var self = this;
  484. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_new", []), "_size", []), "__eq", [0])]);
  485. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_size", []), "__eq", [4])]);
  486. return self;
  487. }
  488. }),
  489. smalltalk.CollectionTest);
  490. smalltalk.addMethod(
  491. "_collectionClass",
  492. smalltalk.method({
  493. selector: "collectionClass",
  494. fn: function () {
  495. var self = this;
  496. return nil;
  497. }
  498. }),
  499. smalltalk.CollectionTest.klass);
  500. smalltalk.addMethod(
  501. "_isAbstract",
  502. smalltalk.method({
  503. selector: "isAbstract",
  504. fn: function () {
  505. var self = this;
  506. var $1;
  507. $1 = smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_isNil", []);
  508. return $1;
  509. }
  510. }),
  511. smalltalk.CollectionTest.klass);
  512. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  513. smalltalk.addMethod(
  514. "_collection",
  515. smalltalk.method({
  516. selector: "collection",
  517. fn: function () {
  518. var self = this;
  519. var $1;
  520. $1 = smalltalk.HashedCollection._fromPairs_([smalltalk.send("a", "__minus_gt", [1]), smalltalk.send("b", "__minus_gt", [2]), smalltalk.send("c", "__minus_gt", [3]), smalltalk.send("d", "__minus_gt", [-4])]);
  521. return $1;
  522. }
  523. }),
  524. smalltalk.HashedCollectionTest);
  525. smalltalk.addMethod(
  526. "_collectionWithDuplicates",
  527. smalltalk.method({
  528. selector: "collectionWithDuplicates",
  529. fn: function () {
  530. var self = this;
  531. var $1;
  532. $1 = smalltalk.HashedCollection._fromPairs_([smalltalk.send("a", "__minus_gt", [1]), smalltalk.send("b", "__minus_gt", [2]), smalltalk.send("c", "__minus_gt", [3]), smalltalk.send("d", "__minus_gt", [-4]), smalltalk.send("e", "__minus_gt", [1]), smalltalk.send("f", "__minus_gt", [2]), smalltalk.send("g", "__minus_gt", [10])]);
  533. return $1;
  534. }
  535. }),
  536. smalltalk.HashedCollectionTest);
  537. smalltalk.addMethod(
  538. "_collectionClass",
  539. smalltalk.method({
  540. selector: "collectionClass",
  541. fn: function () {
  542. var self = this;
  543. return smalltalk.HashedCollection || HashedCollection;
  544. }
  545. }),
  546. smalltalk.HashedCollectionTest.klass);
  547. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  548. smalltalk.addMethod(
  549. "_collection",
  550. smalltalk.method({
  551. selector: "collection",
  552. fn: function () {
  553. var self = this;
  554. var $2, $3, $1;
  555. $2 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  556. smalltalk.send($2, "_at_put_", [1, 1]);
  557. smalltalk.send($2, "_at_put_", ["a", 2]);
  558. smalltalk.send($2, "_at_put_", [true, 3]);
  559. smalltalk.send($2, "_at_put_", [4, -4]);
  560. $3 = smalltalk.send($2, "_yourself", []);
  561. $1 = $3;
  562. return $1;
  563. }
  564. }),
  565. smalltalk.DictionaryTest);
  566. smalltalk.addMethod(
  567. "_collectionWithDuplicates",
  568. smalltalk.method({
  569. selector: "collectionWithDuplicates",
  570. fn: function () {
  571. var self = this;
  572. var $2, $3, $1;
  573. $2 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  574. smalltalk.send($2, "_at_put_", [1, 1]);
  575. smalltalk.send($2, "_at_put_", ["a", 2]);
  576. smalltalk.send($2, "_at_put_", [true, 3]);
  577. smalltalk.send($2, "_at_put_", [4, -4]);
  578. smalltalk.send($2, "_at_put_", ["b", 1]);
  579. smalltalk.send($2, "_at_put_", [3, 3]);
  580. smalltalk.send($2, "_at_put_", [false, 12]);
  581. $3 = smalltalk.send($2, "_yourself", []);
  582. $1 = $3;
  583. return $1;
  584. }
  585. }),
  586. smalltalk.DictionaryTest);
  587. smalltalk.addMethod(
  588. "_testAccessing",
  589. smalltalk.method({
  590. selector: "testAccessing",
  591. fn: function () {
  592. var self = this;
  593. var d;
  594. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  595. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  596. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  597. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", function () {return nil;}]), "__eq", ["world"])]);
  598. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", function () {return nil;}]), "__eq", ["world"])]);
  599. smalltalk.send(d, "_at_put_", [1, 2]);
  600. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [1]), "__eq", [2])]);
  601. smalltalk.send(d, "_at_put_", [smalltalk.send(1, "__at", [3]), 3]);
  602. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send(1, "__at", [3])]), "__eq", [3])]);
  603. return self;
  604. }
  605. }),
  606. smalltalk.DictionaryTest);
  607. smalltalk.addMethod(
  608. "_testDynamicDictionaries",
  609. smalltalk.method({
  610. selector: "testDynamicDictionaries",
  611. fn: function () {
  612. var self = this;
  613. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.HashedCollection._fromPairs_([smalltalk.send("hello", "__minus_gt", [1])]), "_asDictionary", []), "__eq", [smalltalk.send(smalltalk.Dictionary || Dictionary, "_with_", [smalltalk.send("hello", "__minus_gt", [1])])])]);
  614. return self;
  615. }
  616. }),
  617. smalltalk.DictionaryTest);
  618. smalltalk.addMethod(
  619. "_testEquality",
  620. smalltalk.method({
  621. selector: "testEquality",
  622. fn: function () {
  623. var self = this;
  624. var $1, $2, $3, $4, $5, $6, $7, $8, $9, $10;
  625. var d1;
  626. var d2;
  627. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []), "__eq", [smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", [])])]);
  628. $1 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  629. smalltalk.send($1, "_at_put_", [1, 2]);
  630. $2 = smalltalk.send($1, "_yourself", []);
  631. d1 = $2;
  632. $3 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  633. smalltalk.send($3, "_at_put_", [1, 2]);
  634. $4 = smalltalk.send($3, "_yourself", []);
  635. d2 = $4;
  636. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  637. $5 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  638. smalltalk.send($5, "_at_put_", [1, 3]);
  639. $6 = smalltalk.send($5, "_yourself", []);
  640. d2 = $6;
  641. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  642. $7 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  643. smalltalk.send($7, "_at_put_", [2, 2]);
  644. $8 = smalltalk.send($7, "_yourself", []);
  645. d2 = $8;
  646. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  647. $9 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  648. smalltalk.send($9, "_at_put_", [1, 2]);
  649. smalltalk.send($9, "_at_put_", [3, 4]);
  650. $10 = smalltalk.send($9, "_yourself", []);
  651. d2 = $10;
  652. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  653. return self;
  654. }
  655. }),
  656. smalltalk.DictionaryTest);
  657. smalltalk.addMethod(
  658. "_testIfAbsent",
  659. smalltalk.method({
  660. selector: "testIfAbsent",
  661. fn: function () {
  662. var self = this;
  663. var d;
  664. var visited;
  665. visited = false;
  666. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  667. smalltalk.send(d, "_at_ifAbsent_", ["hello", function () {visited = true;return visited;}]);
  668. smalltalk.send(self, "_assert_", [visited]);
  669. return self;
  670. }
  671. }),
  672. smalltalk.DictionaryTest);
  673. smalltalk.addMethod(
  674. "_testIfPresent",
  675. smalltalk.method({
  676. selector: "testIfPresent",
  677. fn: function () {
  678. var self = this;
  679. var d;
  680. var visited;
  681. var absent;
  682. visited = false;
  683. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  684. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  685. smalltalk.send(d, "_at_ifPresent_", ["hello", function (value) {visited = value;return visited;}]);
  686. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  687. absent = smalltalk.send(d, "_at_ifPresent_", ["bye", function (value) {visited = value;return visited;}]);
  688. smalltalk.send(self, "_assert_", [smalltalk.send(absent, "_isNil", [])]);
  689. return self;
  690. }
  691. }),
  692. smalltalk.DictionaryTest);
  693. smalltalk.addMethod(
  694. "_testIfPresentIfAbsent",
  695. smalltalk.method({
  696. selector: "testIfPresentIfAbsent",
  697. fn: function () {
  698. var self = this;
  699. var d;
  700. var visited;
  701. visited = false;
  702. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  703. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  704. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["hello", function (value) {visited = value;return visited;}, function () {visited = true;return visited;}]);
  705. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  706. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["buy", function (value) {visited = value;return visited;}, function () {visited = true;return visited;}]);
  707. smalltalk.send(self, "_assert_", [visited]);
  708. return self;
  709. }
  710. }),
  711. smalltalk.DictionaryTest);
  712. smalltalk.addMethod(
  713. "_testKeys",
  714. smalltalk.method({
  715. selector: "testKeys",
  716. fn: function () {
  717. var self = this;
  718. var d;
  719. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  720. smalltalk.send(d, "_at_put_", [1, 2]);
  721. smalltalk.send(d, "_at_put_", [2, 3]);
  722. smalltalk.send(d, "_at_put_", [3, 4]);
  723. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[1, 2, 3]])]);
  724. return self;
  725. }
  726. }),
  727. smalltalk.DictionaryTest);
  728. smalltalk.addMethod(
  729. "_testPrintString",
  730. smalltalk.method({
  731. selector: "testPrintString",
  732. fn: function () {
  733. var self = this;
  734. var $1, $2;
  735. $1 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  736. smalltalk.send($1, "_at_put_", ["firstname", "James"]);
  737. smalltalk.send($1, "_at_put_", ["lastname", "Bond"]);
  738. $2 = smalltalk.send($1, "_printString", []);
  739. smalltalk.send(self, "_assert_equals_", ["a Dictionary('firstname'->'James' , 'lastname'->'Bond')", $2]);
  740. return self;
  741. }
  742. }),
  743. smalltalk.DictionaryTest);
  744. smalltalk.addMethod(
  745. "_testRemoveKey",
  746. smalltalk.method({
  747. selector: "testRemoveKey",
  748. fn: function () {
  749. var self = this;
  750. var d;
  751. var key;
  752. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  753. smalltalk.send(d, "_at_put_", [1, 2]);
  754. smalltalk.send(d, "_at_put_", [2, 3]);
  755. smalltalk.send(d, "_at_put_", [3, 4]);
  756. key = 2;
  757. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[1, 2, 3]])]);
  758. smalltalk.send(d, "_removeKey_", [key]);
  759. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[1, 3]])]);
  760. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[2, 4]])]);
  761. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [2])]);
  762. return self;
  763. }
  764. }),
  765. smalltalk.DictionaryTest);
  766. smalltalk.addMethod(
  767. "_testRemoveKeyIfAbsent",
  768. smalltalk.method({
  769. selector: "testRemoveKeyIfAbsent",
  770. fn: function () {
  771. var self = this;
  772. var d;
  773. var key;
  774. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  775. smalltalk.send(d, "_at_put_", [1, 2]);
  776. smalltalk.send(d, "_at_put_", [2, 3]);
  777. smalltalk.send(d, "_at_put_", [3, 4]);
  778. key = 2;
  779. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [3])]);
  780. key = 3;
  781. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, function () {return 42;}]), "__eq", [4])]);
  782. key = "why";
  783. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, function () {return 42;}]), "__eq", [42])]);
  784. return self;
  785. }
  786. }),
  787. smalltalk.DictionaryTest);
  788. smalltalk.addMethod(
  789. "_testSize",
  790. smalltalk.method({
  791. selector: "testSize",
  792. fn: function () {
  793. var self = this;
  794. var d;
  795. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  796. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [0])]);
  797. smalltalk.send(d, "_at_put_", [1, 2]);
  798. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [1])]);
  799. smalltalk.send(d, "_at_put_", [2, 3]);
  800. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [2])]);
  801. return self;
  802. }
  803. }),
  804. smalltalk.DictionaryTest);
  805. smalltalk.addMethod(
  806. "_testValues",
  807. smalltalk.method({
  808. selector: "testValues",
  809. fn: function () {
  810. var self = this;
  811. var d;
  812. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  813. smalltalk.send(d, "_at_put_", [1, 2]);
  814. smalltalk.send(d, "_at_put_", [2, 3]);
  815. smalltalk.send(d, "_at_put_", [3, 4]);
  816. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[2, 3, 4]])]);
  817. return self;
  818. }
  819. }),
  820. smalltalk.DictionaryTest);
  821. smalltalk.addMethod(
  822. "_collectionClass",
  823. smalltalk.method({
  824. selector: "collectionClass",
  825. fn: function () {
  826. var self = this;
  827. return smalltalk.Dictionary || Dictionary;
  828. }
  829. }),
  830. smalltalk.DictionaryTest.klass);
  831. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  832. smalltalk.addMethod(
  833. "_testAt",
  834. smalltalk.method({
  835. selector: "testAt",
  836. fn: function () {
  837. var self = this;
  838. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [4]), "__eq", [-4])]);
  839. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [5]);}, smalltalk.Error || Error]);
  840. return self;
  841. }
  842. }),
  843. smalltalk.SequenceableCollectionTest);
  844. smalltalk.addMethod(
  845. "_testAtIfAbsent",
  846. smalltalk.method({
  847. selector: "testAtIfAbsent",
  848. fn: function () {
  849. var self = this;
  850. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_at_ifAbsent_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_size", []), "__plus", [1]), function () {return "none";}]), "__eq", ["none"])]);
  851. return self;
  852. }
  853. }),
  854. smalltalk.SequenceableCollectionTest);
  855. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  856. smalltalk.addMethod(
  857. "_testAtIfAbsent",
  858. smalltalk.method({
  859. selector: "testAtIfAbsent",
  860. fn: function () {
  861. var self = this;
  862. var array;
  863. array = ["hello", "world"];
  864. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [1]), "hello"]);
  865. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [2]), "world"]);
  866. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [2, function () {return "not found";}]), "world"]);
  867. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [0, function () {return "not found";}]), "not found"]);
  868. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [-10, function () {return "not found";}]), "not found"]);
  869. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [3, function () {return "not found";}]), "not found"]);
  870. return self;
  871. }
  872. }),
  873. smalltalk.ArrayTest);
  874. smalltalk.addMethod(
  875. "_testFirstN",
  876. smalltalk.method({
  877. selector: "testFirstN",
  878. fn: function () {
  879. var self = this;
  880. smalltalk.send(self, "_assert_equals_", [[1, 2, 3], smalltalk.send([1, 2, 3, 4, 5], "_first_", [3])]);
  881. return self;
  882. }
  883. }),
  884. smalltalk.ArrayTest);
  885. smalltalk.addMethod(
  886. "_testIfEmpty",
  887. smalltalk.method({
  888. selector: "testIfEmpty",
  889. fn: function () {
  890. var self = this;
  891. smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [function () {return "zork";}])]);
  892. return self;
  893. }
  894. }),
  895. smalltalk.ArrayTest);
  896. smalltalk.addMethod(
  897. "_testPrintString",
  898. smalltalk.method({
  899. selector: "testPrintString",
  900. fn: function () {
  901. var self = this;
  902. var $1, $2;
  903. var array;
  904. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  905. smalltalk.send(self, "_assert_equals_", ["a Array ()", smalltalk.send(array, "_printString", [])]);
  906. smalltalk.send(array, "_add_", [1]);
  907. $1 = smalltalk.send(array, "_add_", [3]);
  908. smalltalk.send(self, "_assert_equals_", ["a Array (1 3)", smalltalk.send(array, "_printString", [])]);
  909. smalltalk.send(array, "_add_", ["foo"]);
  910. smalltalk.send(self, "_assert_equals_", ["a Array (1 3 'foo')", smalltalk.send(array, "_printString", [])]);
  911. smalltalk.send(array, "_remove_", [1]);
  912. $2 = smalltalk.send(array, "_remove_", [3]);
  913. smalltalk.send(self, "_assert_equals_", ["a Array ('foo')", smalltalk.send(array, "_printString", [])]);
  914. smalltalk.send(array, "_addLast_", [3]);
  915. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3)", smalltalk.send(array, "_printString", [])]);
  916. smalltalk.send(array, "_addLast_", [3]);
  917. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3 3)", smalltalk.send(array, "_printString", [])]);
  918. return self;
  919. }
  920. }),
  921. smalltalk.ArrayTest);
  922. smalltalk.addMethod(
  923. "_collectionClass",
  924. smalltalk.method({
  925. selector: "collectionClass",
  926. fn: function () {
  927. var self = this;
  928. return smalltalk.Array || Array;
  929. }
  930. }),
  931. smalltalk.ArrayTest.klass);
  932. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  933. smalltalk.addMethod(
  934. "_collection",
  935. smalltalk.method({
  936. selector: "collection",
  937. fn: function () {
  938. var self = this;
  939. return "hello";
  940. }
  941. }),
  942. smalltalk.StringTest);
  943. smalltalk.addMethod(
  944. "_collectionWithDuplicates",
  945. smalltalk.method({
  946. selector: "collectionWithDuplicates",
  947. fn: function () {
  948. var self = this;
  949. return "abbaerte";
  950. }
  951. }),
  952. smalltalk.StringTest);
  953. smalltalk.addMethod(
  954. "_testAddRemove",
  955. smalltalk.method({
  956. selector: "testAddRemove",
  957. fn: function () {
  958. var self = this;
  959. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_add_", ["a"]);}, smalltalk.Error || Error]);
  960. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_remove_", ["h"]);}, smalltalk.Error || Error]);
  961. return self;
  962. }
  963. }),
  964. smalltalk.StringTest);
  965. smalltalk.addMethod(
  966. "_testAsArray",
  967. smalltalk.method({
  968. selector: "testAsArray",
  969. fn: function () {
  970. var self = this;
  971. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  972. return self;
  973. }
  974. }),
  975. smalltalk.StringTest);
  976. smalltalk.addMethod(
  977. "_testAt",
  978. smalltalk.method({
  979. selector: "testAt",
  980. fn: function () {
  981. var self = this;
  982. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [1]), "__eq", ["h"])]);
  983. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [5]), "__eq", ["o"])]);
  984. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [6, function () {return nil;}]), "__eq", [nil])]);
  985. return self;
  986. }
  987. }),
  988. smalltalk.StringTest);
  989. smalltalk.addMethod(
  990. "_testAtPut",
  991. smalltalk.method({
  992. selector: "testAtPut",
  993. fn: function () {
  994. var self = this;
  995. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_at_put_", [1, "a"]);}, smalltalk.Error || Error]);
  996. return self;
  997. }
  998. }),
  999. smalltalk.StringTest);
  1000. smalltalk.addMethod(
  1001. "_testCollect",
  1002. smalltalk.method({
  1003. selector: "testCollect",
  1004. fn: function () {
  1005. var self = this;
  1006. var newCollection;
  1007. newCollection = "hheelllloo";
  1008. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_collect_", [function (each) {return smalltalk.send(each, "__comma", [each]);}]), newCollection]);
  1009. return self;
  1010. }
  1011. }),
  1012. smalltalk.StringTest);
  1013. smalltalk.addMethod(
  1014. "_testCopyWithoutAll",
  1015. smalltalk.method({
  1016. selector: "testCopyWithoutAll",
  1017. fn: function () {
  1018. var self = this;
  1019. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1020. return self;
  1021. }
  1022. }),
  1023. smalltalk.StringTest);
  1024. smalltalk.addMethod(
  1025. "_testDetect",
  1026. smalltalk.method({
  1027. selector: "testDetect",
  1028. fn: function () {
  1029. var self = this;
  1030. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", ["h"]);}]), "__eq", ["h"])]);
  1031. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", [6]);}]);}, smalltalk.Error || Error]);
  1032. return self;
  1033. }
  1034. }),
  1035. smalltalk.StringTest);
  1036. smalltalk.addMethod(
  1037. "_testEquality",
  1038. smalltalk.method({
  1039. selector: "testEquality",
  1040. fn: function () {
  1041. var self = this;
  1042. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1043. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1044. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1045. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1046. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [0])]);
  1047. return self;
  1048. }
  1049. }),
  1050. smalltalk.StringTest);
  1051. smalltalk.addMethod(
  1052. "_testIdentity",
  1053. smalltalk.method({
  1054. selector: "testIdentity",
  1055. fn: function () {
  1056. var self = this;
  1057. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1058. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1059. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1060. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1061. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [0])]);
  1062. return self;
  1063. }
  1064. }),
  1065. smalltalk.StringTest);
  1066. smalltalk.addMethod(
  1067. "_testIncludesSubString",
  1068. smalltalk.method({
  1069. selector: "testIncludesSubString",
  1070. fn: function () {
  1071. var self = this;
  1072. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1073. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1074. return self;
  1075. }
  1076. }),
  1077. smalltalk.StringTest);
  1078. smalltalk.addMethod(
  1079. "_testJoin",
  1080. smalltalk.method({
  1081. selector: "testJoin",
  1082. fn: function () {
  1083. var self = this;
  1084. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1085. return self;
  1086. }
  1087. }),
  1088. smalltalk.StringTest);
  1089. smalltalk.addMethod(
  1090. "_testSelect",
  1091. smalltalk.method({
  1092. selector: "testSelect",
  1093. fn: function () {
  1094. var self = this;
  1095. var newCollection;
  1096. newCollection = "o";
  1097. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_select_", [function (each) {return smalltalk.send(each, "__eq", ["o"]);}]), newCollection]);
  1098. return self;
  1099. }
  1100. }),
  1101. smalltalk.StringTest);
  1102. smalltalk.addMethod(
  1103. "_testSize",
  1104. smalltalk.method({
  1105. selector: "testSize",
  1106. fn: function () {
  1107. var self = this;
  1108. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), 9]);
  1109. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), 0]);
  1110. return self;
  1111. }
  1112. }),
  1113. smalltalk.StringTest);
  1114. smalltalk.addMethod(
  1115. "_testStreamContents",
  1116. smalltalk.method({
  1117. selector: "testStreamContents",
  1118. fn: function () {
  1119. var self = this;
  1120. var $1;
  1121. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", ["hello"]);smalltalk.send(aStream, "_space", []);$1 = smalltalk.send(aStream, "_nextPutAll_", ["world"]);return $1;}])]);
  1122. return self;
  1123. }
  1124. }),
  1125. smalltalk.StringTest);
  1126. smalltalk.addMethod(
  1127. "_collectionClass",
  1128. smalltalk.method({
  1129. selector: "collectionClass",
  1130. fn: function () {
  1131. var self = this;
  1132. return smalltalk.String || String;
  1133. }
  1134. }),
  1135. smalltalk.StringTest.klass);
  1136. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1137. smalltalk.addMethod(
  1138. "_collection",
  1139. smalltalk.method({
  1140. selector: "collection",
  1141. fn: function () {
  1142. var self = this;
  1143. return smalltalk.symbolFor("hello");
  1144. }
  1145. }),
  1146. smalltalk.SymbolTest);
  1147. smalltalk.addMethod(
  1148. "_collectionWithDuplicates",
  1149. smalltalk.method({
  1150. selector: "collectionWithDuplicates",
  1151. fn: function () {
  1152. var self = this;
  1153. return smalltalk.symbolFor("phhaaarorra");
  1154. }
  1155. }),
  1156. smalltalk.SymbolTest);
  1157. smalltalk.addMethod(
  1158. "_testAsString",
  1159. smalltalk.method({
  1160. selector: "testAsString",
  1161. fn: function () {
  1162. var self = this;
  1163. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1164. return self;
  1165. }
  1166. }),
  1167. smalltalk.SymbolTest);
  1168. smalltalk.addMethod(
  1169. "_testAsSymbol",
  1170. smalltalk.method({
  1171. selector: "testAsSymbol",
  1172. fn: function () {
  1173. var self = this;
  1174. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1175. return self;
  1176. }
  1177. }),
  1178. smalltalk.SymbolTest);
  1179. smalltalk.addMethod(
  1180. "_testAt",
  1181. smalltalk.method({
  1182. selector: "testAt",
  1183. fn: function () {
  1184. var self = this;
  1185. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [1]), "__eq", ["h"])]);
  1186. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [5]), "__eq", ["o"])]);
  1187. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [6, function () {return nil;}]), "__eq", [nil])]);
  1188. return self;
  1189. }
  1190. }),
  1191. smalltalk.SymbolTest);
  1192. smalltalk.addMethod(
  1193. "_testAtPut",
  1194. smalltalk.method({
  1195. selector: "testAtPut",
  1196. fn: function () {
  1197. var self = this;
  1198. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_at_put_", [1, "a"]);}, smalltalk.Error || Error]);
  1199. return self;
  1200. }
  1201. }),
  1202. smalltalk.SymbolTest);
  1203. smalltalk.addMethod(
  1204. "_testCollect",
  1205. smalltalk.method({
  1206. selector: "testCollect",
  1207. fn: function () {
  1208. var self = this;
  1209. var newCollection;
  1210. newCollection = smalltalk.symbolFor("hheelllloo");
  1211. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_collect_", [function (each) {return smalltalk.send(each, "__comma", [each]);}]), newCollection]);
  1212. return self;
  1213. }
  1214. }),
  1215. smalltalk.SymbolTest);
  1216. smalltalk.addMethod(
  1217. "_testComparing",
  1218. smalltalk.method({
  1219. selector: "testComparing",
  1220. fn: function () {
  1221. var self = this;
  1222. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt", [smalltalk.symbolFor("aa")])]);
  1223. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt", [smalltalk.symbolFor("ba")])]);
  1224. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__lt", [smalltalk.symbolFor("ba")])]);
  1225. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("bb"), "__lt", [smalltalk.symbolFor("ba")])]);
  1226. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt_eq", [smalltalk.symbolFor("aa")])]);
  1227. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt_eq", [smalltalk.symbolFor("ba")])]);
  1228. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__lt_eq", [smalltalk.symbolFor("ba")])]);
  1229. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("bb"), "__lt_eq", [smalltalk.symbolFor("ba")])]);
  1230. return self;
  1231. }
  1232. }),
  1233. smalltalk.SymbolTest);
  1234. smalltalk.addMethod(
  1235. "_testCopying",
  1236. smalltalk.method({
  1237. selector: "testCopying",
  1238. fn: function () {
  1239. var self = this;
  1240. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1241. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1242. return self;
  1243. }
  1244. }),
  1245. smalltalk.SymbolTest);
  1246. smalltalk.addMethod(
  1247. "_testDetect",
  1248. smalltalk.method({
  1249. selector: "testDetect",
  1250. fn: function () {
  1251. var self = this;
  1252. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", ["h"]);}]), "__eq", ["h"])]);
  1253. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", ["z"]);}]);}, smalltalk.Error || Error]);
  1254. return self;
  1255. }
  1256. }),
  1257. smalltalk.SymbolTest);
  1258. smalltalk.addMethod(
  1259. "_testEquality",
  1260. smalltalk.method({
  1261. selector: "testEquality",
  1262. fn: function () {
  1263. var self = this;
  1264. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1265. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1266. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1267. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1268. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1269. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1270. return self;
  1271. }
  1272. }),
  1273. smalltalk.SymbolTest);
  1274. smalltalk.addMethod(
  1275. "_testIdentity",
  1276. smalltalk.method({
  1277. selector: "testIdentity",
  1278. fn: function () {
  1279. var self = this;
  1280. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1281. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1282. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1283. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1284. return self;
  1285. }
  1286. }),
  1287. smalltalk.SymbolTest);
  1288. smalltalk.addMethod(
  1289. "_testIsEmpty",
  1290. smalltalk.method({
  1291. selector: "testIsEmpty",
  1292. fn: function () {
  1293. var self = this;
  1294. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_isEmpty", [])]);
  1295. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("", "_asSymbol", []), "_isEmpty", [])]);
  1296. return self;
  1297. }
  1298. }),
  1299. smalltalk.SymbolTest);
  1300. smalltalk.addMethod(
  1301. "_testIsSymbolIsString",
  1302. smalltalk.method({
  1303. selector: "testIsSymbolIsString",
  1304. fn: function () {
  1305. var self = this;
  1306. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1307. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1308. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1309. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1310. return self;
  1311. }
  1312. }),
  1313. smalltalk.SymbolTest);
  1314. smalltalk.addMethod(
  1315. "_testSelect",
  1316. smalltalk.method({
  1317. selector: "testSelect",
  1318. fn: function () {
  1319. var self = this;
  1320. var newCollection;
  1321. newCollection = "o";
  1322. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_select_", [function (each) {return smalltalk.send(each, "__eq", ["o"]);}]), newCollection]);
  1323. return self;
  1324. }
  1325. }),
  1326. smalltalk.SymbolTest);
  1327. smalltalk.addMethod(
  1328. "_testSize",
  1329. smalltalk.method({
  1330. selector: "testSize",
  1331. fn: function () {
  1332. var self = this;
  1333. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), 1]);
  1334. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), 5]);
  1335. return self;
  1336. }
  1337. }),
  1338. smalltalk.SymbolTest);
  1339. smalltalk.addMethod(
  1340. "_collectionClass",
  1341. smalltalk.method({
  1342. selector: "collectionClass",
  1343. fn: function () {
  1344. var self = this;
  1345. return smalltalk.Symbol || Symbol;
  1346. }
  1347. }),
  1348. smalltalk.SymbolTest.klass);
  1349. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1350. smalltalk.addMethod(
  1351. "_jsObject",
  1352. smalltalk.method({
  1353. selector: "jsObject",
  1354. fn: function () {
  1355. var self = this;
  1356. return jsObject = {a: 1, b: function () {return 2;}, c: function (object) {return object;}, d: ""};
  1357. return self;
  1358. }
  1359. }),
  1360. smalltalk.JSObjectProxyTest);
  1361. smalltalk.addMethod(
  1362. "_testDNU",
  1363. smalltalk.method({
  1364. selector: "testDNU",
  1365. fn: function () {
  1366. var self = this;
  1367. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}, smalltalk.MessageNotUnderstood || MessageNotUnderstood]);
  1368. return self;
  1369. }
  1370. }),
  1371. smalltalk.JSObjectProxyTest);
  1372. smalltalk.addMethod(
  1373. "_testMessageSend",
  1374. smalltalk.method({
  1375. selector: "testMessageSend",
  1376. fn: function () {
  1377. var self = this;
  1378. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), 1]);
  1379. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), 2]);
  1380. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [3]), 3]);
  1381. return self;
  1382. }
  1383. }),
  1384. smalltalk.JSObjectProxyTest);
  1385. smalltalk.addMethod(
  1386. "_testMethodWithArguments",
  1387. smalltalk.method({
  1388. selector: "testMethodWithArguments",
  1389. fn: function () {
  1390. var self = this;
  1391. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [1]), 1]);
  1392. return self;
  1393. }
  1394. }),
  1395. smalltalk.JSObjectProxyTest);
  1396. smalltalk.addMethod(
  1397. "_testPrinting",
  1398. smalltalk.method({
  1399. selector: "testPrinting",
  1400. fn: function () {
  1401. var self = this;
  1402. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", ["[object Object]"])]);
  1403. return self;
  1404. }
  1405. }),
  1406. smalltalk.JSObjectProxyTest);
  1407. smalltalk.addMethod(
  1408. "_testPropertyThatReturnsEmptyString",
  1409. smalltalk.method({
  1410. selector: "testPropertyThatReturnsEmptyString",
  1411. fn: function () {
  1412. var self = this;
  1413. var object;
  1414. object = smalltalk.send(self, "_jsObject", []);
  1415. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(object, "_d", [])]);
  1416. smalltalk.send(object, "_d_", ["hello"]);
  1417. smalltalk.send(self, "_assert_equals_", ["hello", smalltalk.send(object, "_d", [])]);
  1418. return self;
  1419. }
  1420. }),
  1421. smalltalk.JSObjectProxyTest);
  1422. smalltalk.addMethod(
  1423. "_testYourself",
  1424. smalltalk.method({
  1425. selector: "testYourself",
  1426. fn: function () {
  1427. var self = this;
  1428. var $1, $2;
  1429. var body;
  1430. $1 = smalltalk.send("body", "_asJQuery", []);
  1431. smalltalk.send($1, "_addClass_", ["amber"]);
  1432. $2 = smalltalk.send($1, "_yourself", []);
  1433. body = $2;
  1434. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  1435. smalltalk.send(body, "_removeClass_", ["amber"]);
  1436. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  1437. return self;
  1438. }
  1439. }),
  1440. smalltalk.JSObjectProxyTest);
  1441. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1442. smalltalk.addMethod(
  1443. "_testAbs",
  1444. smalltalk.method({
  1445. selector: "testAbs",
  1446. fn: function () {
  1447. var self = this;
  1448. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(4, "_abs", []), "__eq", [4])]);
  1449. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(-4, "_abs", []), "__eq", [4])]);
  1450. return self;
  1451. }
  1452. }),
  1453. smalltalk.NumberTest);
  1454. smalltalk.addMethod(
  1455. "_testArithmetic",
  1456. smalltalk.method({
  1457. selector: "testArithmetic",
  1458. fn: function () {
  1459. var self = this;
  1460. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1.5, "__plus", [1]), "__eq", [2.5])]);
  1461. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(2, "__minus", [1]), "__eq", [1])]);
  1462. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(-2, "__minus", [1]), "__eq", [-3])]);
  1463. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(12, "__slash", [2]), "__eq", [6])]);
  1464. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "__star", [4]), "__eq", [12])]);
  1465. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(1, "__plus", [2]), "__star", [3]), "__eq", [9])]);
  1466. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__plus", [smalltalk.send(2, "__star", [3])]), "__eq", [7])]);
  1467. return self;
  1468. }
  1469. }),
  1470. smalltalk.NumberTest);
  1471. smalltalk.addMethod(
  1472. "_testComparison",
  1473. smalltalk.method({
  1474. selector: "testComparison",
  1475. fn: function () {
  1476. var self = this;
  1477. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__gt", [2])]);
  1478. smalltalk.send(self, "_assert_", [smalltalk.send(2, "__lt", [3])]);
  1479. smalltalk.send(self, "_deny_", [smalltalk.send(3, "__lt", [2])]);
  1480. smalltalk.send(self, "_deny_", [smalltalk.send(2, "__gt", [3])]);
  1481. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__gt_eq", [3])]);
  1482. smalltalk.send(self, "_assert_", [smalltalk.send(3.1, "__gt_eq", [3])]);
  1483. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__lt_eq", [3])]);
  1484. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__lt_eq", [3.1])]);
  1485. return self;
  1486. }
  1487. }),
  1488. smalltalk.NumberTest);
  1489. smalltalk.addMethod(
  1490. "_testCopying",
  1491. smalltalk.method({
  1492. selector: "testCopying",
  1493. fn: function () {
  1494. var self = this;
  1495. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_copy", []), "__eq_eq", [1])]);
  1496. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_deepCopy", []), "__eq_eq", [1])]);
  1497. return self;
  1498. }
  1499. }),
  1500. smalltalk.NumberTest);
  1501. smalltalk.addMethod(
  1502. "_testEquality",
  1503. smalltalk.method({
  1504. selector: "testEquality",
  1505. fn: function () {
  1506. var self = this;
  1507. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq", [1])]);
  1508. smalltalk.send(self, "_assert_", [smalltalk.send(0, "__eq", [0])]);
  1509. smalltalk.send(self, "_deny_", [smalltalk.send(1, "__eq", [0])]);
  1510. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq", [1])]);
  1511. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq", [smalltalk.send(1, "_yourself", [])])]);
  1512. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq", [smalltalk.send(1, "_yourself", [])])]);
  1513. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq", [false])]);
  1514. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [0])]);
  1515. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [0])]);
  1516. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq", [""])]);
  1517. return self;
  1518. }
  1519. }),
  1520. smalltalk.NumberTest);
  1521. smalltalk.addMethod(
  1522. "_testIdentity",
  1523. smalltalk.method({
  1524. selector: "testIdentity",
  1525. fn: function () {
  1526. var self = this;
  1527. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq_eq", [1])]);
  1528. smalltalk.send(self, "_assert_", [smalltalk.send(0, "__eq_eq", [0])]);
  1529. smalltalk.send(self, "_deny_", [smalltalk.send(1, "__eq_eq", [0])]);
  1530. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq_eq", [1])]);
  1531. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq_eq", [smalltalk.send(1, "_yourself", [])])]);
  1532. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq_eq", [smalltalk.send(1, "_yourself", [])])]);
  1533. smalltalk.send(self, "_deny_", [smalltalk.send(1, "__eq_eq", [2])]);
  1534. return self;
  1535. }
  1536. }),
  1537. smalltalk.NumberTest);
  1538. smalltalk.addMethod(
  1539. "_testMinMax",
  1540. smalltalk.method({
  1541. selector: "testMinMax",
  1542. fn: function () {
  1543. var self = this;
  1544. smalltalk.send(self, "_assert_equals_", [smalltalk.send(2, "_max_", [5]), 5]);
  1545. smalltalk.send(self, "_assert_equals_", [smalltalk.send(2, "_min_", [5]), 2]);
  1546. return self;
  1547. }
  1548. }),
  1549. smalltalk.NumberTest);
  1550. smalltalk.addMethod(
  1551. "_testNegated",
  1552. smalltalk.method({
  1553. selector: "testNegated",
  1554. fn: function () {
  1555. var self = this;
  1556. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "_negated", []), "__eq", [-3])]);
  1557. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(-3, "_negated", []), "__eq", [3])]);
  1558. return self;
  1559. }
  1560. }),
  1561. smalltalk.NumberTest);
  1562. smalltalk.addMethod(
  1563. "_testPrintShowingDecimalPlaces",
  1564. smalltalk.method({
  1565. selector: "testPrintShowingDecimalPlaces",
  1566. fn: function () {
  1567. var self = this;
  1568. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send(23, "_printShowingDecimalPlaces_", [2])]);
  1569. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send(23.5698, "_printShowingDecimalPlaces_", [2])]);
  1570. smalltalk.send(self, "_assert_equals_", ["-234.56700", smalltalk.send(smalltalk.send(234.567, "_negated", []), "_printShowingDecimalPlaces_", [5])]);
  1571. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send(23.4567, "_printShowingDecimalPlaces_", [0])]);
  1572. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send(23.5567, "_printShowingDecimalPlaces_", [0])]);
  1573. smalltalk.send(self, "_assert_equals_", ["-23", smalltalk.send(smalltalk.send(23.4567, "_negated", []), "_printShowingDecimalPlaces_", [0])]);
  1574. smalltalk.send(self, "_assert_equals_", ["-24", smalltalk.send(smalltalk.send(23.5567, "_negated", []), "_printShowingDecimalPlaces_", [0])]);
  1575. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send(100000000, "_printShowingDecimalPlaces_", [1])]);
  1576. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send(0.98, "_printShowingDecimalPlaces_", [5])]);
  1577. smalltalk.send(self, "_assert_equals_", ["-0.98", smalltalk.send(smalltalk.send(0.98, "_negated", []), "_printShowingDecimalPlaces_", [2])]);
  1578. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send(2.567, "_printShowingDecimalPlaces_", [2])]);
  1579. smalltalk.send(self, "_assert_equals_", ["-2.57", smalltalk.send(-2.567, "_printShowingDecimalPlaces_", [2])]);
  1580. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send(0, "_printShowingDecimalPlaces_", [2])]);
  1581. return self;
  1582. }
  1583. }),
  1584. smalltalk.NumberTest);
  1585. smalltalk.addMethod(
  1586. "_testRounded",
  1587. smalltalk.method({
  1588. selector: "testRounded",
  1589. fn: function () {
  1590. var self = this;
  1591. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "_rounded", []), "__eq", [3])]);
  1592. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.212, "_rounded", []), "__eq", [3])]);
  1593. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.51, "_rounded", []), "__eq", [4])]);
  1594. return self;
  1595. }
  1596. }),
  1597. smalltalk.NumberTest);
  1598. smalltalk.addMethod(
  1599. "_testSqrt",
  1600. smalltalk.method({
  1601. selector: "testSqrt",
  1602. fn: function () {
  1603. var self = this;
  1604. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(4, "_sqrt", []), "__eq", [2])]);
  1605. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(16, "_sqrt", []), "__eq", [4])]);
  1606. return self;
  1607. }
  1608. }),
  1609. smalltalk.NumberTest);
  1610. smalltalk.addMethod(
  1611. "_testSquared",
  1612. smalltalk.method({
  1613. selector: "testSquared",
  1614. fn: function () {
  1615. var self = this;
  1616. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(4, "_squared", []), "__eq", [16])]);
  1617. return self;
  1618. }
  1619. }),
  1620. smalltalk.NumberTest);
  1621. smalltalk.addMethod(
  1622. "_testTimesRepeat",
  1623. smalltalk.method({
  1624. selector: "testTimesRepeat",
  1625. fn: function () {
  1626. var self = this;
  1627. var i;
  1628. i = 0;
  1629. smalltalk.send(0, "_timesRepeat_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  1630. smalltalk.send(self, "_assert_equals_", [i, 0]);
  1631. smalltalk.send(5, "_timesRepeat_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  1632. smalltalk.send(self, "_assert_equals_", [i, 5]);
  1633. return self;
  1634. }
  1635. }),
  1636. smalltalk.NumberTest);
  1637. smalltalk.addMethod(
  1638. "_testTo",
  1639. smalltalk.method({
  1640. selector: "testTo",
  1641. fn: function () {
  1642. var self = this;
  1643. smalltalk.send(self, "_assert_equals_", [smalltalk.send(1, "_to_", [5]), [1, 2, 3, 4, 5]]);
  1644. return self;
  1645. }
  1646. }),
  1647. smalltalk.NumberTest);
  1648. smalltalk.addMethod(
  1649. "_testToBy",
  1650. smalltalk.method({
  1651. selector: "testToBy",
  1652. fn: function () {
  1653. var self = this;
  1654. smalltalk.send(self, "_assert_equals_", [smalltalk.send(0, "_to_by_", [6, 2]), [0, 2, 4, 6]]);
  1655. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(1, "_to_by_", [4, 0]);}, smalltalk.Error || Error]);
  1656. return self;
  1657. }
  1658. }),
  1659. smalltalk.NumberTest);
  1660. smalltalk.addMethod(
  1661. "_testTruncated",
  1662. smalltalk.method({
  1663. selector: "testTruncated",
  1664. fn: function () {
  1665. var self = this;
  1666. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "_truncated", []), "__eq", [3])]);
  1667. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.212, "_truncated", []), "__eq", [3])]);
  1668. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.51, "_truncated", []), "__eq", [3])]);
  1669. return self;
  1670. }
  1671. }),
  1672. smalltalk.NumberTest);
  1673. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1674. smalltalk.addMethod(
  1675. "_foo",
  1676. smalltalk.method({
  1677. selector: "foo",
  1678. fn: function () {
  1679. var self = this;
  1680. return self['@foo'];
  1681. }
  1682. }),
  1683. smalltalk.ObjectMock);
  1684. smalltalk.addMethod(
  1685. "_foo_",
  1686. smalltalk.method({
  1687. selector: "foo:",
  1688. fn: function (anObject) {
  1689. var self = this;
  1690. self['@foo'] = anObject;
  1691. return self;
  1692. }
  1693. }),
  1694. smalltalk.ObjectMock);
  1695. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1696. smalltalk.addMethod(
  1697. "_testBasicAccess",
  1698. smalltalk.method({
  1699. selector: "testBasicAccess",
  1700. fn: function () {
  1701. var self = this;
  1702. var o;
  1703. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1704. smalltalk.send(o, "_basicAt_put_", ["a", 1]);
  1705. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), 1]);
  1706. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  1707. return self;
  1708. }
  1709. }),
  1710. smalltalk.ObjectTest);
  1711. smalltalk.addMethod(
  1712. "_testBasicPerform",
  1713. smalltalk.method({
  1714. selector: "testBasicPerform",
  1715. fn: function () {
  1716. var self = this;
  1717. var o;
  1718. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1719. smalltalk.send(o, "_basicAt_put_", ["func", function () {return "hello";}]);
  1720. smalltalk.send(o, "_basicAt_put_", ["func2", function (a) {return smalltalk.send(a, "__plus", [1]);}]);
  1721. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  1722. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [3]]), 4]);
  1723. return self;
  1724. }
  1725. }),
  1726. smalltalk.ObjectTest);
  1727. smalltalk.addMethod(
  1728. "_testDNU",
  1729. smalltalk.method({
  1730. selector: "testDNU",
  1731. fn: function () {
  1732. var self = this;
  1733. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_foo", []);}, smalltalk.MessageNotUnderstood || MessageNotUnderstood]);
  1734. return self;
  1735. }
  1736. }),
  1737. smalltalk.ObjectTest);
  1738. smalltalk.addMethod(
  1739. "_testEquality",
  1740. smalltalk.method({
  1741. selector: "testEquality",
  1742. fn: function () {
  1743. var self = this;
  1744. var o;
  1745. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1746. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send(smalltalk.Object || Object, "_new", [])])]);
  1747. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  1748. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  1749. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  1750. return self;
  1751. }
  1752. }),
  1753. smalltalk.ObjectTest);
  1754. smalltalk.addMethod(
  1755. "_testHalt",
  1756. smalltalk.method({
  1757. selector: "testHalt",
  1758. fn: function () {
  1759. var self = this;
  1760. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_halt", []);}, smalltalk.Error || Error]);
  1761. return self;
  1762. }
  1763. }),
  1764. smalltalk.ObjectTest);
  1765. smalltalk.addMethod(
  1766. "_testIdentity",
  1767. smalltalk.method({
  1768. selector: "testIdentity",
  1769. fn: function () {
  1770. var self = this;
  1771. var o;
  1772. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1773. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(smalltalk.Object || Object, "_new", [])])]);
  1774. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  1775. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1776. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
  1777. return self;
  1778. }
  1779. }),
  1780. smalltalk.ObjectTest);
  1781. smalltalk.addMethod(
  1782. "_testIfNil",
  1783. smalltalk.method({
  1784. selector: "testIfNil",
  1785. fn: function () {
  1786. var self = this;
  1787. var $2, $1, $4, $3, $6, $5;
  1788. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_isNil", [])]);
  1789. $2 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1790. if (($receiver = $2) == nil || $receiver == undefined) {
  1791. $1 = true;
  1792. } else {
  1793. $1 = $2;
  1794. }
  1795. smalltalk.send(self, "_deny_", [smalltalk.send($1, "__eq", [true])]);
  1796. $4 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1797. if (($receiver = $4) == nil || $receiver == undefined) {
  1798. $3 = $4;
  1799. } else {
  1800. $3 = true;
  1801. }
  1802. smalltalk.send(self, "_assert_", [smalltalk.send($3, "__eq", [true])]);
  1803. $6 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1804. if (($receiver = $6) == nil || $receiver == undefined) {
  1805. $5 = false;
  1806. } else {
  1807. $5 = true;
  1808. }
  1809. smalltalk.send(self, "_assert_", [smalltalk.send($5, "__eq", [true])]);
  1810. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_ifNotNil_ifNil_", [function () {return true;}, function () {return false;}]), "__eq", [true])]);
  1811. return self;
  1812. }
  1813. }),
  1814. smalltalk.ObjectTest);
  1815. smalltalk.addMethod(
  1816. "_testInstVars",
  1817. smalltalk.method({
  1818. selector: "testInstVars",
  1819. fn: function () {
  1820. var self = this;
  1821. var o;
  1822. o = smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_new", []);
  1823. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  1824. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), 1]);
  1825. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), 1]);
  1826. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), 1]);
  1827. return self;
  1828. }
  1829. }),
  1830. smalltalk.ObjectTest);
  1831. smalltalk.addMethod(
  1832. "_testNilUndefined",
  1833. smalltalk.method({
  1834. selector: "testNilUndefined",
  1835. fn: function () {
  1836. var self = this;
  1837. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [undefined])]);
  1838. return self;
  1839. }
  1840. }),
  1841. smalltalk.ObjectTest);
  1842. smalltalk.addMethod(
  1843. "_testYourself",
  1844. smalltalk.method({
  1845. selector: "testYourself",
  1846. fn: function () {
  1847. var self = this;
  1848. var o;
  1849. o = smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_new", []);
  1850. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1851. return self;
  1852. }
  1853. }),
  1854. smalltalk.ObjectTest);
  1855. smalltalk.addMethod(
  1856. "_testidentityHash",
  1857. smalltalk.method({
  1858. selector: "testidentityHash",
  1859. fn: function () {
  1860. var self = this;
  1861. var o1;
  1862. var o2;
  1863. o1 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1864. o2 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1865. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  1866. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  1867. return self;
  1868. }
  1869. }),
  1870. smalltalk.ObjectTest);
  1871. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1872. smalltalk.addMethod(
  1873. "_setUp",
  1874. smalltalk.method({
  1875. selector: "setUp",
  1876. fn: function () {
  1877. var self = this;
  1878. var $1, $2;
  1879. self['@backUpCommitPathJs'] = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathJs", []);
  1880. self['@backUpCommitPathSt'] = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathSt", []);
  1881. smalltalk.send(smalltalk.Package || Package, "_resetCommitPaths", []);
  1882. self['@zorkPackage'] = smalltalk.send(smalltalk.send(smalltalk.Package || Package, "_new", []), "_name_", ["Zork"]);
  1883. $1 = smalltalk.send(smalltalk.Package || Package, "_new", []);
  1884. smalltalk.send($1, "_name_", ["Grul"]);
  1885. smalltalk.send($1, "_commitPathJs_", ["server/grul/js"]);
  1886. smalltalk.send($1, "_commitPathSt_", ["grul/st"]);
  1887. $2 = smalltalk.send($1, "_yourself", []);
  1888. self['@grulPackage'] = $2;
  1889. return self;
  1890. }
  1891. }),
  1892. smalltalk.PackageTest);
  1893. smalltalk.addMethod(
  1894. "_tearDown",
  1895. smalltalk.method({
  1896. selector: "tearDown",
  1897. fn: function () {
  1898. var self = this;
  1899. var $1;
  1900. smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);
  1901. $1 = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);
  1902. return self;
  1903. }
  1904. }),
  1905. smalltalk.PackageTest);
  1906. smalltalk.addMethod(
  1907. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1908. smalltalk.method({
  1909. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1910. fn: function () {
  1911. var self = this;
  1912. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1913. return self;
  1914. }
  1915. }),
  1916. smalltalk.PackageTest);
  1917. smalltalk.addMethod(
  1918. "_testGrulCommitPathStShouldBeGrulSt",
  1919. smalltalk.method({
  1920. selector: "testGrulCommitPathStShouldBeGrulSt",
  1921. fn: function () {
  1922. var self = this;
  1923. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1924. return self;
  1925. }
  1926. }),
  1927. smalltalk.PackageTest);
  1928. smalltalk.addMethod(
  1929. "_testZorkCommitPathJsShouldBeJs",
  1930. smalltalk.method({
  1931. selector: "testZorkCommitPathJsShouldBeJs",
  1932. fn: function () {
  1933. var self = this;
  1934. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1935. return self;
  1936. }
  1937. }),
  1938. smalltalk.PackageTest);
  1939. smalltalk.addMethod(
  1940. "_testZorkCommitPathStShouldBeSt",
  1941. smalltalk.method({
  1942. selector: "testZorkCommitPathStShouldBeSt",
  1943. fn: function () {
  1944. var self = this;
  1945. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1946. return self;
  1947. }
  1948. }),
  1949. smalltalk.PackageTest);
  1950. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  1951. smalltalk.addMethod(
  1952. "_setUp",
  1953. smalltalk.method({
  1954. selector: "setUp",
  1955. fn: function () {
  1956. var self = this;
  1957. var $1;
  1958. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  1959. smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathJs_", ["javascripts/"]);
  1960. $1 = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathSt_", ["smalltalk/"]);
  1961. return self;
  1962. }
  1963. }),
  1964. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1965. smalltalk.addMethod(
  1966. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1967. smalltalk.method({
  1968. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1969. fn: function () {
  1970. var self = this;
  1971. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1972. return self;
  1973. }
  1974. }),
  1975. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1976. smalltalk.addMethod(
  1977. "_testGrulCommitPathStShouldBeGrulSt",
  1978. smalltalk.method({
  1979. selector: "testGrulCommitPathStShouldBeGrulSt",
  1980. fn: function () {
  1981. var self = this;
  1982. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1983. return self;
  1984. }
  1985. }),
  1986. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1987. smalltalk.addMethod(
  1988. "_testZorkCommitPathJsShouldBeJavascript",
  1989. smalltalk.method({
  1990. selector: "testZorkCommitPathJsShouldBeJavascript",
  1991. fn: function () {
  1992. var self = this;
  1993. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1994. return self;
  1995. }
  1996. }),
  1997. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1998. smalltalk.addMethod(
  1999. "_testZorkCommitPathStShouldBeSmalltalk",
  2000. smalltalk.method({
  2001. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2002. fn: function () {
  2003. var self = this;
  2004. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  2005. return self;
  2006. }
  2007. }),
  2008. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2009. smalltalk.addMethod(
  2010. "_shouldInheritSelectors",
  2011. smalltalk.method({
  2012. selector: "shouldInheritSelectors",
  2013. fn: function () {
  2014. var self = this;
  2015. return false;
  2016. }
  2017. }),
  2018. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2019. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2020. smalltalk.addMethod(
  2021. "_testAccessing",
  2022. smalltalk.method({
  2023. selector: "testAccessing",
  2024. fn: function () {
  2025. var self = this;
  2026. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_x_y_", [3, 4]), "_x", []), 3]);
  2027. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_x_y_", [3, 4]), "_y", []), 4]);
  2028. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_new", []), "_x_", [3]), "_x", []), 3]);
  2029. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_new", []), "_y_", [4]), "_y", []), 4]);
  2030. return self;
  2031. }
  2032. }),
  2033. smalltalk.PointTest);
  2034. smalltalk.addMethod(
  2035. "_testArithmetic",
  2036. smalltalk.method({
  2037. selector: "testArithmetic",
  2038. fn: function () {
  2039. var self = this;
  2040. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__star", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [9, 16])]);
  2041. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__plus", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [6, 8])]);
  2042. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__minus", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [0, 0])]);
  2043. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(6, "__at", [8]), "__slash", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [2, 2])]);
  2044. return self;
  2045. }
  2046. }),
  2047. smalltalk.PointTest);
  2048. smalltalk.addMethod(
  2049. "_testAt",
  2050. smalltalk.method({
  2051. selector: "testAt",
  2052. fn: function () {
  2053. var self = this;
  2054. smalltalk.send(self, "_assert_equals_", [smalltalk.send(3, "__at", [4]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [3, 4])]);
  2055. return self;
  2056. }
  2057. }),
  2058. smalltalk.PointTest);
  2059. smalltalk.addMethod(
  2060. "_testEgality",
  2061. smalltalk.method({
  2062. selector: "testEgality",
  2063. fn: function () {
  2064. var self = this;
  2065. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__eq", [smalltalk.send(3, "__at", [4])])]);
  2066. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(3, "__at", [5]), "__eq", [smalltalk.send(3, "__at", [6])])]);
  2067. return self;
  2068. }
  2069. }),
  2070. smalltalk.PointTest);
  2071. smalltalk.addMethod(
  2072. "_testTranslateBy",
  2073. smalltalk.method({
  2074. selector: "testTranslateBy",
  2075. fn: function () {
  2076. var self = this;
  2077. smalltalk.send(self, "_assert_equals_", [smalltalk.send(3, "__at", [4]), smalltalk.send(smalltalk.send(3, "__at", [3]), "_translateBy_", [smalltalk.send(0, "__at", [1])])]);
  2078. smalltalk.send(self, "_assert_equals_", [smalltalk.send(3, "__at", [2]), smalltalk.send(smalltalk.send(3, "__at", [3]), "_translateBy_", [smalltalk.send(0, "__at", [smalltalk.send(1, "_negated", [])])])]);
  2079. smalltalk.send(self, "_assert_equals_", [smalltalk.send(5, "__at", [6]), smalltalk.send(smalltalk.send(3, "__at", [3]), "_translateBy_", [smalltalk.send(2, "__at", [3])])]);
  2080. smalltalk.send(self, "_assert_equals_", [smalltalk.send(0, "__at", [3]), smalltalk.send(smalltalk.send(3, "__at", [3]), "_translateBy_", [smalltalk.send(smalltalk.send(3, "_negated", []), "__at", [0])])]);
  2081. return self;
  2082. }
  2083. }),
  2084. smalltalk.PointTest);
  2085. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2086. smalltalk.addMethod(
  2087. "_textNext",
  2088. smalltalk.method({
  2089. selector: "textNext",
  2090. fn: function () {
  2091. var self = this;
  2092. smalltalk.send(10000, "_timesRepeat_", [function () {var current;var next;next = smalltalk.send(smalltalk.send(smalltalk.Random || Random, "_new", []), "_next", []);smalltalk.send(self, "_assert_", [smalltalk.send(next, "__gt_eq", [0])]);smalltalk.send(self, "_assert_", [smalltalk.send(next, "__lt", [1])]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);}]);
  2093. return self;
  2094. }
  2095. }),
  2096. smalltalk.RandomTest);
  2097. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2098. smalltalk.addMethod(
  2099. "_testAddRemove",
  2100. smalltalk.method({
  2101. selector: "testAddRemove",
  2102. fn: function () {
  2103. var self = this;
  2104. var set;
  2105. set = smalltalk.send(smalltalk.Set || Set, "_new", []);
  2106. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  2107. smalltalk.send(set, "_add_", [3]);
  2108. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [3])]);
  2109. smalltalk.send(set, "_add_", [5]);
  2110. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [5])]);
  2111. smalltalk.send(set, "_remove_", [3]);
  2112. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [3])]);
  2113. return self;
  2114. }
  2115. }),
  2116. smalltalk.SetTest);
  2117. smalltalk.addMethod(
  2118. "_testAt",
  2119. smalltalk.method({
  2120. selector: "testAt",
  2121. fn: function () {
  2122. var self = this;
  2123. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_new", []), "_at_put_", [1, 2]);}, smalltalk.Error || Error]);
  2124. return self;
  2125. }
  2126. }),
  2127. smalltalk.SetTest);
  2128. smalltalk.addMethod(
  2129. "_testPrintString",
  2130. smalltalk.method({
  2131. selector: "testPrintString",
  2132. fn: function () {
  2133. var self = this;
  2134. var $1, $2;
  2135. var set;
  2136. set = smalltalk.send(smalltalk.Set || Set, "_new", []);
  2137. smalltalk.send(self, "_assert_equals_", ["a Set ()", smalltalk.send(set, "_printString", [])]);
  2138. smalltalk.send(set, "_add_", [1]);
  2139. $1 = smalltalk.send(set, "_add_", [3]);
  2140. smalltalk.send(self, "_assert_equals_", ["a Set (1 3)", smalltalk.send(set, "_printString", [])]);
  2141. smalltalk.send(set, "_add_", ["foo"]);
  2142. smalltalk.send(self, "_assert_equals_", ["a Set (1 3 'foo')", smalltalk.send(set, "_printString", [])]);
  2143. smalltalk.send(set, "_remove_", [1]);
  2144. $2 = smalltalk.send(set, "_remove_", [3]);
  2145. smalltalk.send(self, "_assert_equals_", ["a Set ('foo')", smalltalk.send(set, "_printString", [])]);
  2146. smalltalk.send(set, "_add_", [3]);
  2147. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  2148. smalltalk.send(set, "_add_", [3]);
  2149. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  2150. return self;
  2151. }
  2152. }),
  2153. smalltalk.SetTest);
  2154. smalltalk.addMethod(
  2155. "_testSize",
  2156. smalltalk.method({
  2157. selector: "testSize",
  2158. fn: function () {
  2159. var self = this;
  2160. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_new", []), "_size", []), 0]);
  2161. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_withAll_", [[1, 2, 3, 4]]), "_size", []), 4]);
  2162. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_withAll_", [[1, 1, 1, 1]]), "_size", []), 1]);
  2163. return self;
  2164. }
  2165. }),
  2166. smalltalk.SetTest);
  2167. smalltalk.addMethod(
  2168. "_testUnicity",
  2169. smalltalk.method({
  2170. selector: "testUnicity",
  2171. fn: function () {
  2172. var self = this;
  2173. var set;
  2174. set = smalltalk.send(smalltalk.Set || Set, "_new", []);
  2175. smalltalk.send(set, "_add_", [21]);
  2176. smalltalk.send(set, "_add_", ["hello"]);
  2177. smalltalk.send(set, "_add_", [21]);
  2178. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [2])]);
  2179. smalltalk.send(set, "_add_", ["hello"]);
  2180. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [2])]);
  2181. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [21, "hello"]]);
  2182. return self;
  2183. }
  2184. }),
  2185. smalltalk.SetTest);
  2186. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2187. smalltalk.addMethod(
  2188. "_testCopying",
  2189. smalltalk.method({
  2190. selector: "testCopying",
  2191. fn: function () {
  2192. var self = this;
  2193. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  2194. return self;
  2195. }
  2196. }),
  2197. smalltalk.UndefinedTest);
  2198. smalltalk.addMethod(
  2199. "_testDeepCopy",
  2200. smalltalk.method({
  2201. selector: "testDeepCopy",
  2202. fn: function () {
  2203. var self = this;
  2204. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  2205. return self;
  2206. }
  2207. }),
  2208. smalltalk.UndefinedTest);
  2209. smalltalk.addMethod(
  2210. "_testIfNil",
  2211. smalltalk.method({
  2212. selector: "testIfNil",
  2213. fn: function () {
  2214. var self = this;
  2215. var $1, $2, $3;
  2216. if (($receiver = nil) == nil || $receiver == undefined) {
  2217. $1 = true;
  2218. } else {
  2219. $1 = nil;
  2220. }
  2221. smalltalk.send(self, "_assert_equals_", [$1, true]);
  2222. if (($receiver = nil) == nil || $receiver == undefined) {
  2223. $2 = nil;
  2224. } else {
  2225. $2 = true;
  2226. }
  2227. smalltalk.send(self, "_deny_", [smalltalk.send($2, "__eq", [true])]);
  2228. if (($receiver = nil) == nil || $receiver == undefined) {
  2229. $3 = true;
  2230. } else {
  2231. $3 = false;
  2232. }
  2233. smalltalk.send(self, "_assert_equals_", [$3, true]);
  2234. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(nil, "_ifNotNil_ifNil_", [function () {return true;}, function () {return false;}]), "__eq", [true])]);
  2235. return self;
  2236. }
  2237. }),
  2238. smalltalk.UndefinedTest);
  2239. smalltalk.addMethod(
  2240. "_testIsNil",
  2241. smalltalk.method({
  2242. selector: "testIsNil",
  2243. fn: function () {
  2244. var self = this;
  2245. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  2246. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  2247. return self;
  2248. }
  2249. }),
  2250. smalltalk.UndefinedTest);