Kernel-Tests.deploy.js 143 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790
  1. smalltalk.addPackage('Kernel-Tests');
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "testCanClearInterval",
  6. fn: function (){
  7. var self=this;
  8. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  9. return smalltalk.withContext(function($ctx1) {
  10. self._shouldnt_raise_((function(){
  11. return smalltalk.withContext(function($ctx2) {
  12. return _st(_st((function(){
  13. return smalltalk.withContext(function($ctx3) {
  14. return _st(_st($Error())._new())._signal();
  15. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  16. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  17. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  18. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]}),
  19. smalltalk.BlockClosureTest);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "testCanClearTimeout",
  23. fn: function (){
  24. var self=this;
  25. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  26. return smalltalk.withContext(function($ctx1) {
  27. self._shouldnt_raise_((function(){
  28. return smalltalk.withContext(function($ctx2) {
  29. return _st(_st((function(){
  30. return smalltalk.withContext(function($ctx3) {
  31. return _st(_st($Error())._new())._signal();
  32. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  33. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  34. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  35. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]}),
  36. smalltalk.BlockClosureTest);
  37. smalltalk.addMethod(
  38. smalltalk.method({
  39. selector: "testCompiledSource",
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. self._assert_(_st(_st((function(){
  44. return smalltalk.withContext(function($ctx2) {
  45. return (1).__plus((1));
  46. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  47. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  48. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]}),
  49. smalltalk.BlockClosureTest);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "testCurrySelf",
  53. fn: function (){
  54. var self=this;
  55. var curriedMethod,array;
  56. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  57. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  58. return smalltalk.withContext(function($ctx1) {
  59. curriedMethod=_st(_st((function(selfarg,x){
  60. return smalltalk.withContext(function($ctx2) {
  61. return _st(selfarg)._at_(x);
  62. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  63. array=[(3), (1), (4)];
  64. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  65. _st((function(){
  66. return smalltalk.withContext(function($ctx2) {
  67. return self._assert_equals_(_st(array)._foo_((2)),(1));
  68. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  69. return smalltalk.withContext(function($ctx2) {
  70. return _st($Array())._removeCompiledMethod_(curriedMethod);
  71. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  72. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  73. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]}),
  74. smalltalk.BlockClosureTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testEnsure",
  78. fn: function (){
  79. var self=this;
  80. return smalltalk.withContext(function($ctx1) {
  81. self._assert_equals_(_st((function(){
  82. return smalltalk.withContext(function($ctx2) {
  83. return (3);
  84. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  85. return smalltalk.withContext(function($ctx2) {
  86. return (4);
  87. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  88. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  89. messageSends: ["assert:equals:", "ensure:"]}),
  90. smalltalk.BlockClosureTest);
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "testEnsureRaises",
  94. fn: function (){
  95. var self=this;
  96. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  97. return smalltalk.withContext(function($ctx1) {
  98. self._should_raise_((function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. return _st((function(){
  101. return smalltalk.withContext(function($ctx3) {
  102. return _st(_st($Error())._new())._signal();
  103. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  104. return smalltalk.withContext(function($ctx3) {
  105. return true;
  106. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  108. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  109. messageSends: ["should:raise:", "ensure:", "signal", "new"]}),
  110. smalltalk.BlockClosureTest);
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testExceptionSemantics",
  114. fn: function (){
  115. var self=this;
  116. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  117. return smalltalk.withContext(function($ctx1) {
  118. self._timeout_((100));
  119. _st(self._async_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. self._assert_(true);
  124. _st($Error())._signal();
  125. self._deny_(true);
  126. return self._finished();
  127. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  128. return smalltalk.withContext(function($ctx3) {
  129. return self._finished();
  130. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  132. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  133. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]}),
  134. smalltalk.BlockClosureTest);
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "testNewWithValues",
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. function theTestPrototype() {this.name = "theTestPrototype";}
  142. function theTestConstructor(arg1, arg2, arg3) {}
  143. theTestConstructor.prototype = new theTestPrototype;
  144. var theWrappedConstructor = _st(theTestConstructor);
  145. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  146. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  147. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  148. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  149. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  150. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  151. messageSends: []}),
  152. smalltalk.BlockClosureTest);
  153. smalltalk.addMethod(
  154. smalltalk.method({
  155. selector: "testNumArgs",
  156. fn: function (){
  157. var self=this;
  158. return smalltalk.withContext(function($ctx1) {
  159. self._assert_equals_(_st((function(){
  160. return smalltalk.withContext(function($ctx2) {
  161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs(),(0));
  162. self._assert_equals_(_st((function(a,b){
  163. return smalltalk.withContext(function($ctx2) {
  164. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  165. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  166. messageSends: ["assert:equals:", "numArgs"]}),
  167. smalltalk.BlockClosureTest);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "testOnDo",
  171. fn: function (){
  172. var self=this;
  173. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  174. return smalltalk.withContext(function($ctx1) {
  175. self._assert_(_st((function(){
  176. return smalltalk.withContext(function($ctx2) {
  177. return _st(_st($Error())._new())._signal();
  178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  179. return smalltalk.withContext(function($ctx2) {
  180. return true;
  181. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  182. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  183. messageSends: ["assert:", "on:do:", "signal", "new"]}),
  184. smalltalk.BlockClosureTest);
  185. smalltalk.addMethod(
  186. smalltalk.method({
  187. selector: "testValue",
  188. fn: function (){
  189. var self=this;
  190. return smalltalk.withContext(function($ctx1) {
  191. self._assert_equals_(_st((function(){
  192. return smalltalk.withContext(function($ctx2) {
  193. return (1).__plus((1));
  194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value(),(2));
  195. self._assert_equals_(_st((function(x){
  196. return smalltalk.withContext(function($ctx2) {
  197. return _st(x).__plus((1));
  198. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  199. self._assert_equals_(_st((function(x,y){
  200. return smalltalk.withContext(function($ctx2) {
  201. return _st(x).__star(y);
  202. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  203. self._assert_equals_(_st((function(a,b,c){
  204. return smalltalk.withContext(function($ctx2) {
  205. return (1);
  206. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  208. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]}),
  209. smalltalk.BlockClosureTest);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "testValueWithPossibleArguments",
  213. fn: function (){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) {
  216. self._assert_equals_(_st((function(){
  217. return smalltalk.withContext(function($ctx2) {
  218. return (1);
  219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  220. self._assert_equals_(_st((function(a){
  221. return smalltalk.withContext(function($ctx2) {
  222. return _st(a).__plus((4));
  223. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  224. self._assert_equals_(_st((function(a,b){
  225. return smalltalk.withContext(function($ctx2) {
  226. return _st(a).__plus(b);
  227. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  228. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  229. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]}),
  230. smalltalk.BlockClosureTest);
  231. smalltalk.addMethod(
  232. smalltalk.method({
  233. selector: "testWhileFalse",
  234. fn: function (){
  235. var self=this;
  236. var i;
  237. return smalltalk.withContext(function($ctx1) {
  238. i=(0);
  239. _st((function(){
  240. return smalltalk.withContext(function($ctx2) {
  241. return _st(i).__gt((5));
  242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  243. return smalltalk.withContext(function($ctx2) {
  244. i=_st(i).__plus((1));
  245. return i;
  246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  247. self._assert_equals_(i,(6));
  248. i=(0);
  249. _st((function(){
  250. return smalltalk.withContext(function($ctx2) {
  251. i=_st(i).__plus((1));
  252. i;
  253. return _st(i).__gt((5));
  254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  255. self._assert_equals_(i,(6));
  256. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  257. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]}),
  258. smalltalk.BlockClosureTest);
  259. smalltalk.addMethod(
  260. smalltalk.method({
  261. selector: "testWhileTrue",
  262. fn: function (){
  263. var self=this;
  264. var i;
  265. return smalltalk.withContext(function($ctx1) {
  266. i=(0);
  267. _st((function(){
  268. return smalltalk.withContext(function($ctx2) {
  269. return _st(i).__lt((5));
  270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  271. return smalltalk.withContext(function($ctx2) {
  272. i=_st(i).__plus((1));
  273. return i;
  274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  275. self._assert_equals_(i,(5));
  276. i=(0);
  277. _st((function(){
  278. return smalltalk.withContext(function($ctx2) {
  279. i=_st(i).__plus((1));
  280. i;
  281. return _st(i).__lt((5));
  282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  283. self._assert_equals_(i,(5));
  284. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  285. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]}),
  286. smalltalk.BlockClosureTest);
  287. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  288. smalltalk.addMethod(
  289. smalltalk.method({
  290. selector: "testEquality",
  291. fn: function (){
  292. var self=this;
  293. return smalltalk.withContext(function($ctx1) {
  294. self._deny_((0).__eq(false));
  295. self._deny_(false.__eq((0)));
  296. self._deny_("".__eq(false));
  297. self._deny_(false.__eq(""));
  298. self._assert_(true.__eq(true));
  299. self._deny_(false.__eq(true));
  300. self._deny_(true.__eq(false));
  301. self._assert_(false.__eq(false));
  302. self._assert_(_st(true._yourself()).__eq(true));
  303. self._assert_(_st(true._yourself()).__eq(true._yourself()));
  304. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  305. messageSends: ["deny:", "=", "assert:", "yourself"]}),
  306. smalltalk.BooleanTest);
  307. smalltalk.addMethod(
  308. smalltalk.method({
  309. selector: "testIdentity",
  310. fn: function (){
  311. var self=this;
  312. return smalltalk.withContext(function($ctx1) {
  313. self._deny_((0).__eq_eq(false));
  314. self._deny_(false.__eq_eq((0)));
  315. self._deny_("".__eq_eq(false));
  316. self._deny_(false.__eq_eq(""));
  317. self._assert_(true.__eq_eq(true));
  318. self._deny_(false.__eq_eq(true));
  319. self._deny_(true.__eq_eq(false));
  320. self._assert_(false.__eq_eq(false));
  321. self._assert_(_st(true._yourself()).__eq_eq(true));
  322. self._assert_(_st(true._yourself()).__eq_eq(true._yourself()));
  323. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  324. messageSends: ["deny:", "==", "assert:", "yourself"]}),
  325. smalltalk.BooleanTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testIfTrueIfFalse",
  329. fn: function (){
  330. var self=this;
  331. return smalltalk.withContext(function($ctx1) {
  332. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  333. $1=self;
  334. if(smalltalk.assert(true)){
  335. $2="alternative block";
  336. };
  337. _st($1)._assert_equals_($2,"alternative block");
  338. $3=self;
  339. if(! smalltalk.assert(true)){
  340. $4="alternative block";
  341. };
  342. _st($3)._assert_equals_($4,nil);
  343. $5=self;
  344. if(smalltalk.assert(false)){
  345. $6="alternative block";
  346. };
  347. _st($5)._assert_equals_($6,nil);
  348. $7=self;
  349. if(! smalltalk.assert(false)){
  350. $8="alternative block";
  351. };
  352. _st($7)._assert_equals_($8,"alternative block");
  353. $9=self;
  354. if(smalltalk.assert(false)){
  355. $10="alternative block";
  356. } else {
  357. $10="alternative block2";
  358. };
  359. _st($9)._assert_equals_($10,"alternative block2");
  360. $11=self;
  361. if(smalltalk.assert(false)){
  362. $12="alternative block2";
  363. } else {
  364. $12="alternative block";
  365. };
  366. _st($11)._assert_equals_($12,"alternative block");
  367. $13=self;
  368. if(smalltalk.assert(true)){
  369. $14="alternative block";
  370. } else {
  371. $14="alternative block2";
  372. };
  373. _st($13)._assert_equals_($14,"alternative block");
  374. $15=self;
  375. if(smalltalk.assert(true)){
  376. $16="alternative block2";
  377. } else {
  378. $16="alternative block";
  379. };
  380. _st($15)._assert_equals_($16,"alternative block2");
  381. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  382. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]}),
  383. smalltalk.BooleanTest);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "testIfTrueIfFalseWithBoxing",
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  391. $1=self;
  392. $3=true._yourself();
  393. if(smalltalk.assert($3)){
  394. $2="alternative block";
  395. };
  396. _st($1)._assert_equals_($2,"alternative block");
  397. $4=self;
  398. $6=true._yourself();
  399. if(! smalltalk.assert($6)){
  400. $5="alternative block";
  401. };
  402. _st($4)._assert_equals_($5,nil);
  403. $7=self;
  404. $9=false._yourself();
  405. if(smalltalk.assert($9)){
  406. $8="alternative block";
  407. };
  408. _st($7)._assert_equals_($8,nil);
  409. $10=self;
  410. $12=false._yourself();
  411. if(! smalltalk.assert($12)){
  412. $11="alternative block";
  413. };
  414. _st($10)._assert_equals_($11,"alternative block");
  415. $13=self;
  416. $15=false._yourself();
  417. if(smalltalk.assert($15)){
  418. $14="alternative block";
  419. } else {
  420. $14="alternative block2";
  421. };
  422. _st($13)._assert_equals_($14,"alternative block2");
  423. $16=self;
  424. $18=false._yourself();
  425. if(smalltalk.assert($18)){
  426. $17="alternative block2";
  427. } else {
  428. $17="alternative block";
  429. };
  430. _st($16)._assert_equals_($17,"alternative block");
  431. $19=self;
  432. $21=true._yourself();
  433. if(smalltalk.assert($21)){
  434. $20="alternative block";
  435. } else {
  436. $20="alternative block2";
  437. };
  438. _st($19)._assert_equals_($20,"alternative block");
  439. $22=self;
  440. $24=true._yourself();
  441. if(smalltalk.assert($24)){
  442. $23="alternative block2";
  443. } else {
  444. $23="alternative block";
  445. };
  446. _st($22)._assert_equals_($23,"alternative block2");
  447. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  448. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]}),
  449. smalltalk.BooleanTest);
  450. smalltalk.addMethod(
  451. smalltalk.method({
  452. selector: "testLogic",
  453. fn: function (){
  454. var self=this;
  455. return smalltalk.withContext(function($ctx1) {
  456. var $1,$2,$3,$4,$5,$6,$7,$8;
  457. $1=self;
  458. _st($1)._assert_(true.__and(true));
  459. _st($1)._deny_(true.__and(false));
  460. _st($1)._deny_(false.__and(true));
  461. $2=_st($1)._deny_(false.__and(false));
  462. $3=self;
  463. _st($3)._assert_(true.__or(true));
  464. _st($3)._assert_(true.__or(false));
  465. _st($3)._assert_(false.__or(true));
  466. $4=_st($3)._deny_(false.__or(false));
  467. $5=self;
  468. _st($5)._assert_(true.__and((1).__gt((0))));
  469. _st($5)._deny_(_st((1).__gt((0))).__and(false));
  470. $6=_st($5)._deny_(_st((1).__gt((0))).__and((1).__gt((2))));
  471. $7=self;
  472. _st($7)._assert_(false.__or((1).__gt((0))));
  473. _st($7)._assert_(_st((1).__gt((0))).__or(false));
  474. $8=_st($7)._assert_(_st((1).__gt((0))).__or((1).__gt((2))));
  475. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  476. messageSends: ["assert:", "&", "deny:", "|", ">"]}),
  477. smalltalk.BooleanTest);
  478. smalltalk.addMethod(
  479. smalltalk.method({
  480. selector: "testLogicKeywords",
  481. fn: function (){
  482. var self=this;
  483. return smalltalk.withContext(function($ctx1) {
  484. var $1,$2,$3,$4,$5,$6,$7,$8;
  485. $1=self;
  486. _st($1)._assert_(true._and_((function(){
  487. return smalltalk.withContext(function($ctx2) {
  488. return true;
  489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  490. _st($1)._deny_(true._and_((function(){
  491. return smalltalk.withContext(function($ctx2) {
  492. return false;
  493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})));
  494. _st($1)._deny_(false._and_((function(){
  495. return smalltalk.withContext(function($ctx2) {
  496. return true;
  497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})));
  498. $2=_st($1)._deny_(false._and_((function(){
  499. return smalltalk.withContext(function($ctx2) {
  500. return false;
  501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})));
  502. $3=self;
  503. _st($3)._assert_(true._or_((function(){
  504. return smalltalk.withContext(function($ctx2) {
  505. return true;
  506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})})));
  507. _st($3)._assert_(true._or_((function(){
  508. return smalltalk.withContext(function($ctx2) {
  509. return false;
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})})));
  511. _st($3)._assert_(false._or_((function(){
  512. return smalltalk.withContext(function($ctx2) {
  513. return true;
  514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})})));
  515. $4=_st($3)._deny_(false._or_((function(){
  516. return smalltalk.withContext(function($ctx2) {
  517. return false;
  518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})));
  519. $5=self;
  520. _st($5)._assert_(true._and_((function(){
  521. return smalltalk.withContext(function($ctx2) {
  522. return (1).__gt((0));
  523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})})));
  524. _st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  525. return smalltalk.withContext(function($ctx2) {
  526. return false;
  527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})));
  528. $6=_st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  529. return smalltalk.withContext(function($ctx2) {
  530. return (1).__gt((2));
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})})));
  532. $7=self;
  533. _st($7)._assert_(false._or_((function(){
  534. return smalltalk.withContext(function($ctx2) {
  535. return (1).__gt((0));
  536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})));
  537. _st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  538. return smalltalk.withContext(function($ctx2) {
  539. return false;
  540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})})));
  541. $8=_st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  542. return smalltalk.withContext(function($ctx2) {
  543. return (1).__gt((2));
  544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})})));
  545. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  546. messageSends: ["assert:", "and:", "deny:", "or:", ">"]}),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testNonBooleanError",
  551. fn: function (){
  552. var self=this;
  553. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  554. return smalltalk.withContext(function($ctx1) {
  555. self._should_raise_((function(){
  556. return smalltalk.withContext(function($ctx2) {
  557. if(smalltalk.assert("")){
  558. } else {
  559. };
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  561. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  562. messageSends: ["should:raise:", "ifTrue:ifFalse:"]}),
  563. smalltalk.BooleanTest);
  564. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  565. smalltalk.addMethod(
  566. smalltalk.method({
  567. selector: "setUp",
  568. fn: function (){
  569. var self=this;
  570. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  571. return smalltalk.withContext(function($ctx1) {
  572. self["@builder"]=_st($ClassBuilder())._new();
  573. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  574. messageSends: ["new"]}),
  575. smalltalk.ClassBuilderTest);
  576. smalltalk.addMethod(
  577. smalltalk.method({
  578. selector: "tearDown",
  579. fn: function (){
  580. var self=this;
  581. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  582. return smalltalk.withContext(function($ctx1) {
  583. var $1;
  584. $1=self["@theClass"];
  585. if(($receiver = $1) == nil || $receiver == undefined){
  586. $1;
  587. } else {
  588. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  589. self["@theClass"]=nil;
  590. self["@theClass"];
  591. };
  592. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  593. messageSends: ["ifNotNil:", "removeClass:", "current"]}),
  594. smalltalk.ClassBuilderTest);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "testClassCopy",
  598. fn: function (){
  599. var self=this;
  600. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  601. return smalltalk.withContext(function($ctx1) {
  602. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  603. self._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st($ObjectMock())._superclass()));
  604. self._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st($ObjectMock())._instanceVariableNames()));
  605. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  606. self._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st($ObjectMock())._package()));
  607. self._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st($ObjectMock())._methodDictionary())._keys());
  608. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  609. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]}),
  610. smalltalk.ClassBuilderTest);
  611. smalltalk.addMethod(
  612. smalltalk.method({
  613. selector: "testClassMigration",
  614. fn: function (){
  615. var self=this;
  616. var instance,oldClass;
  617. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  618. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  619. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  620. return smalltalk.withContext(function($ctx1) {
  621. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  622. instance=_st(_st(_st($Smalltalk())._current())._at_("ObjectMock2"))._new();
  623. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  624. self._deny_(_st(oldClass).__eq_eq($ObjectMock2()));
  625. self._assert_(_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock()));
  626. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  627. self._assert_equals_(_st($ObjectMock2())._selectors(),_st(oldClass)._selectors());
  628. self._assert_equals_(_st($ObjectMock2())._comment(),_st(oldClass)._comment());
  629. self._assert_equals_(_st(_st($ObjectMock2())._package())._name(),"Kernel-Tests");
  630. self._deny_(_st(_st(instance)._class()).__eq_eq($ObjectMock2()));
  631. self._assert_(_st(_st(_st($Smalltalk())._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  632. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  633. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  634. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]}),
  635. smalltalk.ClassBuilderTest);
  636. smalltalk.addMethod(
  637. smalltalk.method({
  638. selector: "testClassMigrationWithClassInstanceVariables",
  639. fn: function (){
  640. var self=this;
  641. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  642. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  643. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  644. return smalltalk.withContext(function($ctx1) {
  645. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  646. _st(_st($ObjectMock2())._class())._instanceVariableNames_("foo bar");
  647. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  648. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  649. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  650. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  651. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"]}),
  652. smalltalk.ClassBuilderTest);
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "testClassMigrationWithSubclasses",
  656. fn: function (){
  657. var self=this;
  658. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  659. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  660. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  661. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  662. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  663. return smalltalk.withContext(function($ctx1) {
  664. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  665. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  666. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  667. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  668. self._assert_(_st(_st($ObjectMock())._subclasses())._includes_($ObjectMock2()));
  669. self._assert_(_st(_st($ObjectMock2())._subclasses())._includes_($ObjectMock3()));
  670. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  671. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  672. return smalltalk.withContext(function($ctx2) {
  673. return _st(_st($Smalltalk())._current())._removeClass_(each);
  674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  675. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  676. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]}),
  677. smalltalk.ClassBuilderTest);
  678. smalltalk.addMethod(
  679. smalltalk.method({
  680. selector: "testInstanceVariableNames",
  681. fn: function (){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  685. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  686. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]}),
  687. smalltalk.ClassBuilderTest);
  688. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  689. smalltalk.addMethod(
  690. smalltalk.method({
  691. selector: "assertSameContents:as:",
  692. fn: function (aCollection,anotherCollection){
  693. var self=this;
  694. return smalltalk.withContext(function($ctx1) {
  695. self._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  696. _st(aCollection)._do_((function(each){
  697. return smalltalk.withContext(function($ctx2) {
  698. return self._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  700. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  701. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]}),
  702. smalltalk.CollectionTest);
  703. smalltalk.addMethod(
  704. smalltalk.method({
  705. selector: "collection",
  706. fn: function (){
  707. var self=this;
  708. return smalltalk.withContext(function($ctx1) {
  709. var $1;
  710. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  711. return $1;
  712. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  713. messageSends: ["withAll:", "collectionClass", "defaultValues"]}),
  714. smalltalk.CollectionTest);
  715. smalltalk.addMethod(
  716. smalltalk.method({
  717. selector: "collectionClass",
  718. fn: function (){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) {
  721. var $1;
  722. $1=_st(self._class())._collectionClass();
  723. return $1;
  724. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  725. messageSends: ["collectionClass", "class"]}),
  726. smalltalk.CollectionTest);
  727. smalltalk.addMethod(
  728. smalltalk.method({
  729. selector: "collectionWithDuplicates",
  730. fn: function (){
  731. var self=this;
  732. return smalltalk.withContext(function($ctx1) {
  733. var $1;
  734. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  735. return $1;
  736. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  737. messageSends: ["withAll:", "collectionClass"]}),
  738. smalltalk.CollectionTest);
  739. smalltalk.addMethod(
  740. smalltalk.method({
  741. selector: "defaultValues",
  742. fn: function (){
  743. var self=this;
  744. return smalltalk.withContext(function($ctx1) {
  745. var $1;
  746. $1=[(1), (2), (3), (-4)];
  747. return $1;
  748. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  749. messageSends: []}),
  750. smalltalk.CollectionTest);
  751. smalltalk.addMethod(
  752. smalltalk.method({
  753. selector: "isCollectionReadOnly",
  754. fn: function (){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) {
  757. return false;
  758. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  759. messageSends: []}),
  760. smalltalk.CollectionTest);
  761. smalltalk.addMethod(
  762. smalltalk.method({
  763. selector: "testAsArray",
  764. fn: function (){
  765. var self=this;
  766. return smalltalk.withContext(function($ctx1) {
  767. self._assertSameContents_as_(self._collection(),_st(self._collection())._asArray());
  768. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  769. messageSends: ["assertSameContents:as:", "collection", "asArray"]}),
  770. smalltalk.CollectionTest);
  771. smalltalk.addMethod(
  772. smalltalk.method({
  773. selector: "testAsOrderedCollection",
  774. fn: function (){
  775. var self=this;
  776. return smalltalk.withContext(function($ctx1) {
  777. self._assertSameContents_as_(self._collection(),_st(self._collection())._asOrderedCollection());
  778. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  779. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]}),
  780. smalltalk.CollectionTest);
  781. smalltalk.addMethod(
  782. smalltalk.method({
  783. selector: "testAsSet",
  784. fn: function (){
  785. var self=this;
  786. var c,set;
  787. return smalltalk.withContext(function($ctx1) {
  788. c=self._collectionWithDuplicates();
  789. set=_st(c)._asSet();
  790. self._assert_equals_(_st(set)._size(),(5));
  791. _st(c)._do_((function(each){
  792. return smalltalk.withContext(function($ctx2) {
  793. return self._assert_(_st(set)._includes_(each));
  794. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  795. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  796. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]}),
  797. smalltalk.CollectionTest);
  798. smalltalk.addMethod(
  799. smalltalk.method({
  800. selector: "testCollect",
  801. fn: function (){
  802. var self=this;
  803. var newCollection;
  804. return smalltalk.withContext(function($ctx1) {
  805. newCollection=[(1), (2), (3), (4)];
  806. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  807. return smalltalk.withContext(function($ctx2) {
  808. return _st(each)._abs();
  809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  810. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  811. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"]}),
  812. smalltalk.CollectionTest);
  813. smalltalk.addMethod(
  814. smalltalk.method({
  815. selector: "testDetect",
  816. fn: function (){
  817. var self=this;
  818. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  819. return smalltalk.withContext(function($ctx1) {
  820. self._assert_equals_(_st(self._collection())._detect_((function(each){
  821. return smalltalk.withContext(function($ctx2) {
  822. return _st(each).__lt((0));
  823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),(-4));
  824. self._should_raise_((function(){
  825. return smalltalk.withContext(function($ctx2) {
  826. return _st(self._collection())._detect_((function(each){
  827. return smalltalk.withContext(function($ctx3) {
  828. return _st(each).__eq((6));
  829. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  831. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  832. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="]}),
  833. smalltalk.CollectionTest);
  834. smalltalk.addMethod(
  835. smalltalk.method({
  836. selector: "testDo",
  837. fn: function (){
  838. var self=this;
  839. var newCollection;
  840. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  841. return smalltalk.withContext(function($ctx1) {
  842. newCollection=_st($OrderedCollection())._new();
  843. _st(self._collection())._do_((function(each){
  844. return smalltalk.withContext(function($ctx2) {
  845. return _st(newCollection)._add_(each);
  846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  847. self._assertSameContents_as_(self._collection(),newCollection);
  848. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  849. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"]}),
  850. smalltalk.CollectionTest);
  851. smalltalk.addMethod(
  852. smalltalk.method({
  853. selector: "testIsEmpty",
  854. fn: function (){
  855. var self=this;
  856. return smalltalk.withContext(function($ctx1) {
  857. self._assert_(_st(_st(self._collectionClass())._new())._isEmpty());
  858. self._deny_(_st(self._collection())._isEmpty());
  859. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  860. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]}),
  861. smalltalk.CollectionTest);
  862. smalltalk.addMethod(
  863. smalltalk.method({
  864. selector: "testSelect",
  865. fn: function (){
  866. var self=this;
  867. var newCollection;
  868. return smalltalk.withContext(function($ctx1) {
  869. newCollection=[(2), (-4)];
  870. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  871. return smalltalk.withContext(function($ctx2) {
  872. return _st(each)._even();
  873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  874. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  875. messageSends: ["assertSameContents:as:", "select:", "collection", "even"]}),
  876. smalltalk.CollectionTest);
  877. smalltalk.addMethod(
  878. smalltalk.method({
  879. selector: "testSize",
  880. fn: function (){
  881. var self=this;
  882. return smalltalk.withContext(function($ctx1) {
  883. self._assert_equals_(_st(_st(self._collectionClass())._new())._size(),(0));
  884. self._assert_equals_(_st(self._collection())._size(),(4));
  885. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  886. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"]}),
  887. smalltalk.CollectionTest);
  888. smalltalk.addMethod(
  889. smalltalk.method({
  890. selector: "collectionClass",
  891. fn: function (){
  892. var self=this;
  893. return smalltalk.withContext(function($ctx1) {
  894. return nil;
  895. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  896. messageSends: []}),
  897. smalltalk.CollectionTest.klass);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "isAbstract",
  901. fn: function (){
  902. var self=this;
  903. return smalltalk.withContext(function($ctx1) {
  904. var $1;
  905. $1=_st(self._collectionClass())._isNil();
  906. return $1;
  907. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  908. messageSends: ["isNil", "collectionClass"]}),
  909. smalltalk.CollectionTest.klass);
  910. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  911. smalltalk.addMethod(
  912. smalltalk.method({
  913. selector: "testAt",
  914. fn: function (){
  915. var self=this;
  916. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  917. return smalltalk.withContext(function($ctx1) {
  918. self._assert_equals_(_st(self._collection())._at_((4)),(-4));
  919. self._should_raise_((function(){
  920. return smalltalk.withContext(function($ctx2) {
  921. return _st(self._collection())._at_((5));
  922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  923. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  924. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"]}),
  925. smalltalk.IndexableCollectionTest);
  926. smalltalk.addMethod(
  927. smalltalk.method({
  928. selector: "testAtIfAbsent",
  929. fn: function (){
  930. var self=this;
  931. return smalltalk.withContext(function($ctx1) {
  932. self._assert_equals_(_st(self._collection())._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return "none";
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"none");
  936. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  937. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"]}),
  938. smalltalk.IndexableCollectionTest);
  939. smalltalk.addMethod(
  940. smalltalk.method({
  941. selector: "testContains",
  942. fn: function (){
  943. var self=this;
  944. var collection;
  945. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  946. return smalltalk.withContext(function($ctx1) {
  947. collection=self._collection();
  948. self._assert_(_st(self._collection())._contains_((function(each){
  949. return smalltalk.withContext(function($ctx2) {
  950. return _st(each).__eq(_st(self._collection())._first());
  951. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  952. self._deny_(_st(self._collection())._contains_((function(each){
  953. return smalltalk.withContext(function($ctx2) {
  954. return _st(each).__eq(_st($Object())._new());
  955. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  956. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  957. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"]}),
  958. smalltalk.IndexableCollectionTest);
  959. smalltalk.addMethod(
  960. smalltalk.method({
  961. selector: "testIndexOf",
  962. fn: function (){
  963. var self=this;
  964. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  965. return smalltalk.withContext(function($ctx1) {
  966. self._assert_equals_(_st(self._collection())._indexOf_((2)),(2));
  967. self._should_raise_((function(){
  968. return smalltalk.withContext(function($ctx2) {
  969. return _st(self._collection())._indexOf_((999));
  970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  971. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  972. return smalltalk.withContext(function($ctx2) {
  973. return "sentinel";
  974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  975. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  976. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  977. smalltalk.IndexableCollectionTest);
  978. smalltalk.addMethod(
  979. smalltalk.method({
  980. selector: "testWithIndexDo",
  981. fn: function (){
  982. var self=this;
  983. var collection;
  984. return smalltalk.withContext(function($ctx1) {
  985. collection=self._collection();
  986. _st(self._collection())._withIndexDo_((function(each,index){
  987. return smalltalk.withContext(function($ctx2) {
  988. return self._assert_equals_(_st(collection)._at_(index),each);
  989. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  990. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  991. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]}),
  992. smalltalk.IndexableCollectionTest);
  993. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  994. smalltalk.addMethod(
  995. smalltalk.method({
  996. selector: "collection",
  997. fn: function (){
  998. var self=this;
  999. return smalltalk.withContext(function($ctx1) {
  1000. var $1;
  1001. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4))]);
  1002. return $1;
  1003. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1004. messageSends: ["->"]}),
  1005. smalltalk.HashedCollectionTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "collectionWithDuplicates",
  1009. fn: function (){
  1010. var self=this;
  1011. return smalltalk.withContext(function($ctx1) {
  1012. var $1;
  1013. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4)),"e".__minus_gt((1)),"f".__minus_gt((2)),"g".__minus_gt((10))]);
  1014. return $1;
  1015. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1016. messageSends: ["->"]}),
  1017. smalltalk.HashedCollectionTest);
  1018. smalltalk.addMethod(
  1019. smalltalk.method({
  1020. selector: "testAsDictionary",
  1021. fn: function (){
  1022. var self=this;
  1023. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1024. return smalltalk.withContext(function($ctx1) {
  1025. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1026. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1027. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]}),
  1028. smalltalk.HashedCollectionTest);
  1029. smalltalk.addMethod(
  1030. smalltalk.method({
  1031. selector: "testAt",
  1032. fn: function (){
  1033. var self=this;
  1034. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1035. return smalltalk.withContext(function($ctx1) {
  1036. self._assert_equals_(_st(self._collection())._at_("a"),(2));
  1037. self._should_raise_((function(){
  1038. return smalltalk.withContext(function($ctx2) {
  1039. return _st(self._collection())._at_((5));
  1040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1041. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1042. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"]}),
  1043. smalltalk.HashedCollectionTest);
  1044. smalltalk.addMethod(
  1045. smalltalk.method({
  1046. selector: "testContains",
  1047. fn: function (){
  1048. var self=this;
  1049. var collection;
  1050. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1051. return smalltalk.withContext(function($ctx1) {
  1052. collection=self._collection();
  1053. self._assert_(_st(self._collection())._contains_((function(each){
  1054. return smalltalk.withContext(function($ctx2) {
  1055. return _st(each).__eq(_st(_st(self._collection())._values())._first());
  1056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  1057. self._deny_(_st(self._collection())._contains_((function(each){
  1058. return smalltalk.withContext(function($ctx2) {
  1059. return _st(each).__eq(_st($Object())._new());
  1060. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1061. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1062. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"]}),
  1063. smalltalk.HashedCollectionTest);
  1064. smalltalk.addMethod(
  1065. smalltalk.method({
  1066. selector: "testFrom",
  1067. fn: function (){
  1068. var self=this;
  1069. var associations;
  1070. return smalltalk.withContext(function($ctx1) {
  1071. associations=["a".__minus_gt((1)),"b".__minus_gt((2))];
  1072. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1073. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1074. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]}),
  1075. smalltalk.HashedCollectionTest);
  1076. smalltalk.addMethod(
  1077. smalltalk.method({
  1078. selector: "testIndexOf",
  1079. fn: function (){
  1080. var self=this;
  1081. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1082. return smalltalk.withContext(function($ctx1) {
  1083. self._assert_equals_(_st(self._collection())._indexOf_((2)),"a");
  1084. self._should_raise_((function(){
  1085. return smalltalk.withContext(function($ctx2) {
  1086. return _st(self._collection())._indexOf_((999));
  1087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1088. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1089. return smalltalk.withContext(function($ctx2) {
  1090. return "sentinel";
  1091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1092. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1093. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  1094. smalltalk.HashedCollectionTest);
  1095. smalltalk.addMethod(
  1096. smalltalk.method({
  1097. selector: "testNewFromPairs",
  1098. fn: function (){
  1099. var self=this;
  1100. var flattenedAssociations;
  1101. return smalltalk.withContext(function($ctx1) {
  1102. flattenedAssociations=["a",(1),"b",(2)];
  1103. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1104. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1105. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"]}),
  1106. smalltalk.HashedCollectionTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "collectionClass",
  1110. fn: function (){
  1111. var self=this;
  1112. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1113. return smalltalk.withContext(function($ctx1) {
  1114. var $1;
  1115. $1=$HashedCollection();
  1116. return $1;
  1117. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1118. messageSends: []}),
  1119. smalltalk.HashedCollectionTest.klass);
  1120. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1121. smalltalk.addMethod(
  1122. smalltalk.method({
  1123. selector: "collection",
  1124. fn: function (){
  1125. var self=this;
  1126. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1127. return smalltalk.withContext(function($ctx1) {
  1128. var $2,$3,$1;
  1129. $2=_st($Dictionary())._new();
  1130. _st($2)._at_put_((1),(1));
  1131. _st($2)._at_put_("a",(2));
  1132. _st($2)._at_put_(true,(3));
  1133. _st($2)._at_put_((4),(-4));
  1134. $3=_st($2)._yourself();
  1135. $1=$3;
  1136. return $1;
  1137. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1138. messageSends: ["at:put:", "new", "yourself"]}),
  1139. smalltalk.DictionaryTest);
  1140. smalltalk.addMethod(
  1141. smalltalk.method({
  1142. selector: "collectionWithDuplicates",
  1143. fn: function (){
  1144. var self=this;
  1145. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$3,$1;
  1148. $2=_st($Dictionary())._new();
  1149. _st($2)._at_put_((1),(1));
  1150. _st($2)._at_put_("a",(2));
  1151. _st($2)._at_put_(true,(3));
  1152. _st($2)._at_put_((4),(-4));
  1153. _st($2)._at_put_("b",(1));
  1154. _st($2)._at_put_((3),(3));
  1155. _st($2)._at_put_(false,(12));
  1156. $3=_st($2)._yourself();
  1157. $1=$3;
  1158. return $1;
  1159. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1160. messageSends: ["at:put:", "new", "yourself"]}),
  1161. smalltalk.DictionaryTest);
  1162. smalltalk.addMethod(
  1163. smalltalk.method({
  1164. selector: "testAccessing",
  1165. fn: function (){
  1166. var self=this;
  1167. var d;
  1168. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1169. return smalltalk.withContext(function($ctx1) {
  1170. d=_st($Dictionary())._new();
  1171. _st(d)._at_put_("hello","world");
  1172. self._assert_equals_(_st(d)._at_("hello"),"world");
  1173. self._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1174. return smalltalk.withContext(function($ctx2) {
  1175. return nil;
  1176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"world");
  1177. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1178. return smalltalk.withContext(function($ctx2) {
  1179. return nil;
  1180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  1181. self._assert_(_st(d)._includesKey_("hello"));
  1182. self._deny_(_st(d)._includesKey_("foo"));
  1183. _st(d)._at_put_((1),(2));
  1184. self._assert_equals_(_st(d)._at_((1)),(2));
  1185. _st(d)._at_put_((1).__at((3)),(3));
  1186. self._assert_equals_(_st(d)._at_((1).__at((3))),(3));
  1187. self._assert_(_st(d)._includesKey_((1).__at((3))));
  1188. self._deny_(_st(d)._includesKey_((3).__at((1))));
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1190. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]}),
  1191. smalltalk.DictionaryTest);
  1192. smalltalk.addMethod(
  1193. smalltalk.method({
  1194. selector: "testAsHashedCollection",
  1195. fn: function (){
  1196. var self=this;
  1197. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1198. return smalltalk.withContext(function($ctx1) {
  1199. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  1200. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  1201. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]}),
  1202. smalltalk.DictionaryTest);
  1203. smalltalk.addMethod(
  1204. smalltalk.method({
  1205. selector: "testDynamicDictionaries",
  1206. fn: function (){
  1207. var self=this;
  1208. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1209. return smalltalk.withContext(function($ctx1) {
  1210. self._assert_equals_(_st(smalltalk.HashedCollection._from_(["hello".__minus_gt((1))]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  1211. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1212. messageSends: ["assert:equals:", "asDictionary", "->", "with:"]}),
  1213. smalltalk.DictionaryTest);
  1214. smalltalk.addMethod(
  1215. smalltalk.method({
  1216. selector: "testEquality",
  1217. fn: function (){
  1218. var self=this;
  1219. var d1,d2;
  1220. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1221. return smalltalk.withContext(function($ctx1) {
  1222. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1223. self._assert_(_st(_st($Dictionary())._new()).__eq(_st($Dictionary())._new()));
  1224. $1=_st($Dictionary())._new();
  1225. _st($1)._at_put_((1),(2));
  1226. $2=_st($1)._yourself();
  1227. d1=$2;
  1228. $3=_st($Dictionary())._new();
  1229. _st($3)._at_put_((1),(2));
  1230. $4=_st($3)._yourself();
  1231. d2=$4;
  1232. self._assert_(_st(d1).__eq(d2));
  1233. $5=_st($Dictionary())._new();
  1234. _st($5)._at_put_((1),(3));
  1235. $6=_st($5)._yourself();
  1236. d2=$6;
  1237. self._deny_(_st(d1).__eq(d2));
  1238. $7=_st($Dictionary())._new();
  1239. _st($7)._at_put_((2),(2));
  1240. $8=_st($7)._yourself();
  1241. d2=$8;
  1242. self._deny_(_st(d1).__eq(d2));
  1243. $9=_st($Dictionary())._new();
  1244. _st($9)._at_put_((1),(2));
  1245. _st($9)._at_put_((3),(4));
  1246. $10=_st($9)._yourself();
  1247. d2=$10;
  1248. self._deny_(_st(d1).__eq(d2));
  1249. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  1250. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"]}),
  1251. smalltalk.DictionaryTest);
  1252. smalltalk.addMethod(
  1253. smalltalk.method({
  1254. selector: "testIfAbsent",
  1255. fn: function (){
  1256. var self=this;
  1257. var d,visited;
  1258. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1259. return smalltalk.withContext(function($ctx1) {
  1260. visited=false;
  1261. d=_st($Dictionary())._new();
  1262. _st(d)._at_ifAbsent_("hello",(function(){
  1263. return smalltalk.withContext(function($ctx2) {
  1264. visited=true;
  1265. return visited;
  1266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1267. self._assert_(visited);
  1268. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1269. messageSends: ["new", "at:ifAbsent:", "assert:"]}),
  1270. smalltalk.DictionaryTest);
  1271. smalltalk.addMethod(
  1272. smalltalk.method({
  1273. selector: "testIfPresent",
  1274. fn: function (){
  1275. var self=this;
  1276. var d,visited,absent;
  1277. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1278. return smalltalk.withContext(function($ctx1) {
  1279. visited=false;
  1280. d=_st($Dictionary())._new();
  1281. _st(d)._at_put_("hello","world");
  1282. _st(d)._at_ifPresent_("hello",(function(value){
  1283. return smalltalk.withContext(function($ctx2) {
  1284. visited=value;
  1285. return visited;
  1286. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  1287. self._assert_equals_(visited,"world");
  1288. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1289. return smalltalk.withContext(function($ctx2) {
  1290. visited=value;
  1291. return visited;
  1292. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  1293. self._assert_(_st(absent)._isNil());
  1294. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  1295. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"]}),
  1296. smalltalk.DictionaryTest);
  1297. smalltalk.addMethod(
  1298. smalltalk.method({
  1299. selector: "testIfPresentIfAbsent",
  1300. fn: function (){
  1301. var self=this;
  1302. var d,visited;
  1303. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1304. return smalltalk.withContext(function($ctx1) {
  1305. visited=false;
  1306. d=_st($Dictionary())._new();
  1307. _st(d)._at_put_("hello","world");
  1308. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1309. return smalltalk.withContext(function($ctx2) {
  1310. visited=value;
  1311. return visited;
  1312. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  1313. return smalltalk.withContext(function($ctx2) {
  1314. visited=true;
  1315. return visited;
  1316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1317. self._assert_equals_(visited,"world");
  1318. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1319. return smalltalk.withContext(function($ctx2) {
  1320. visited=value;
  1321. return visited;
  1322. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  1323. return smalltalk.withContext(function($ctx2) {
  1324. visited=true;
  1325. return visited;
  1326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1327. self._assert_(visited);
  1328. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1329. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"]}),
  1330. smalltalk.DictionaryTest);
  1331. smalltalk.addMethod(
  1332. smalltalk.method({
  1333. selector: "testKeys",
  1334. fn: function (){
  1335. var self=this;
  1336. var d;
  1337. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1338. return smalltalk.withContext(function($ctx1) {
  1339. d=_st($Dictionary())._new();
  1340. _st(d)._at_put_((1),(2));
  1341. _st(d)._at_put_((2),(3));
  1342. _st(d)._at_put_((3),(4));
  1343. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1344. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  1345. messageSends: ["new", "at:put:", "assert:equals:", "keys"]}),
  1346. smalltalk.DictionaryTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "testPointKey",
  1350. fn: function (){
  1351. var self=this;
  1352. var d;
  1353. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1354. return smalltalk.withContext(function($ctx1) {
  1355. d=_st($Dictionary())._new();
  1356. _st(d)._at_put_((1).__at((1)),"foo");
  1357. self._assert_equals_(_st(d)._at_((1).__at((1))),"foo");
  1358. _st(d)._at_put_((1).__at((1)),"bar");
  1359. self._assert_equals_(_st(d)._at_((1).__at((1))),"bar");
  1360. _st(d)._removeKey_((1).__at((1)));
  1361. self._assert_equals_(_st(d)._at_ifAbsent_((1).__at((1)),(function(){
  1362. return smalltalk.withContext(function($ctx2) {
  1363. return "baz";
  1364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"baz");
  1365. self._deny_(_st(d)._includesKey_((1).__at((1))));
  1366. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  1367. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"]}),
  1368. smalltalk.DictionaryTest);
  1369. smalltalk.addMethod(
  1370. smalltalk.method({
  1371. selector: "testPrintString",
  1372. fn: function (){
  1373. var self=this;
  1374. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1375. return smalltalk.withContext(function($ctx1) {
  1376. var $1,$2;
  1377. $1=_st($Dictionary())._new();
  1378. _st($1)._at_put_("firstname","James");
  1379. _st($1)._at_put_("lastname","Bond");
  1380. $2=_st($1)._printString();
  1381. self._assert_equals_($2,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  1382. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  1383. messageSends: ["assert:equals:", "at:put:", "new", "printString"]}),
  1384. smalltalk.DictionaryTest);
  1385. smalltalk.addMethod(
  1386. smalltalk.method({
  1387. selector: "testRemoveKey",
  1388. fn: function (){
  1389. var self=this;
  1390. var d,key;
  1391. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1392. return smalltalk.withContext(function($ctx1) {
  1393. d=_st($Dictionary())._new();
  1394. _st(d)._at_put_((1),(2));
  1395. _st(d)._at_put_((2),(3));
  1396. _st(d)._at_put_((3),(4));
  1397. key=(2);
  1398. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1399. _st(d)._removeKey_(key);
  1400. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1401. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  1402. self._deny_(_st(d)._includesKey_((2)));
  1403. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  1404. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"]}),
  1405. smalltalk.DictionaryTest);
  1406. smalltalk.addMethod(
  1407. smalltalk.method({
  1408. selector: "testRemoveKeyIfAbsent",
  1409. fn: function (){
  1410. var self=this;
  1411. var d,key;
  1412. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1413. return smalltalk.withContext(function($ctx1) {
  1414. d=_st($Dictionary())._new();
  1415. _st(d)._at_put_((1),(2));
  1416. _st(d)._at_put_((2),(3));
  1417. _st(d)._at_put_((3),(4));
  1418. key=(2);
  1419. self._assert_equals_(_st(d)._removeKey_(key),(3));
  1420. key=(3);
  1421. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1422. return smalltalk.withContext(function($ctx2) {
  1423. return (42);
  1424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),(4));
  1425. key="why";
  1426. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1427. return smalltalk.withContext(function($ctx2) {
  1428. return (42);
  1429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  1430. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  1431. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"]}),
  1432. smalltalk.DictionaryTest);
  1433. smalltalk.addMethod(
  1434. smalltalk.method({
  1435. selector: "testSize",
  1436. fn: function (){
  1437. var self=this;
  1438. var d;
  1439. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1440. return smalltalk.withContext(function($ctx1) {
  1441. d=_st($Dictionary())._new();
  1442. self._assert_equals_(_st(d)._size(),(0));
  1443. _st(d)._at_put_((1),(2));
  1444. self._assert_equals_(_st(d)._size(),(1));
  1445. _st(d)._at_put_((2),(3));
  1446. self._assert_equals_(_st(d)._size(),(2));
  1447. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  1448. messageSends: ["new", "assert:equals:", "size", "at:put:"]}),
  1449. smalltalk.DictionaryTest);
  1450. smalltalk.addMethod(
  1451. smalltalk.method({
  1452. selector: "testValues",
  1453. fn: function (){
  1454. var self=this;
  1455. var d;
  1456. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1457. return smalltalk.withContext(function($ctx1) {
  1458. d=_st($Dictionary())._new();
  1459. _st(d)._at_put_((1),(2));
  1460. _st(d)._at_put_((2),(3));
  1461. _st(d)._at_put_((3),(4));
  1462. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1463. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  1464. messageSends: ["new", "at:put:", "assert:equals:", "values"]}),
  1465. smalltalk.DictionaryTest);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "collectionClass",
  1469. fn: function (){
  1470. var self=this;
  1471. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1472. return smalltalk.withContext(function($ctx1) {
  1473. var $1;
  1474. $1=$Dictionary();
  1475. return $1;
  1476. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  1477. messageSends: []}),
  1478. smalltalk.DictionaryTest.klass);
  1479. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1480. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1481. smalltalk.addMethod(
  1482. smalltalk.method({
  1483. selector: "testAddFirst",
  1484. fn: function (){
  1485. var self=this;
  1486. return smalltalk.withContext(function($ctx1) {
  1487. var $1,$2;
  1488. $1=[(2), (3), (4), (5)];
  1489. _st($1)._addFirst_((1));
  1490. $2=_st($1)._yourself();
  1491. self._assert_equals_($2,[(1), (2), (3), (4), (5)]);
  1492. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  1493. messageSends: ["assert:equals:", "addFirst:", "yourself"]}),
  1494. smalltalk.ArrayTest);
  1495. smalltalk.addMethod(
  1496. smalltalk.method({
  1497. selector: "testAtIfAbsent",
  1498. fn: function (){
  1499. var self=this;
  1500. var array;
  1501. return smalltalk.withContext(function($ctx1) {
  1502. array=["hello", "world"];
  1503. self._assert_equals_(_st(array)._at_((1)),"hello");
  1504. self._assert_equals_(_st(array)._at_((2)),"world");
  1505. self._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1506. return smalltalk.withContext(function($ctx2) {
  1507. return "not found";
  1508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"world");
  1509. self._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1510. return smalltalk.withContext(function($ctx2) {
  1511. return "not found";
  1512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"not found");
  1513. self._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1514. return smalltalk.withContext(function($ctx2) {
  1515. return "not found";
  1516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),"not found");
  1517. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1518. return smalltalk.withContext(function($ctx2) {
  1519. return "not found";
  1520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"not found");
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  1522. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"]}),
  1523. smalltalk.ArrayTest);
  1524. smalltalk.addMethod(
  1525. smalltalk.method({
  1526. selector: "testFirstN",
  1527. fn: function (){
  1528. var self=this;
  1529. return smalltalk.withContext(function($ctx1) {
  1530. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1531. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  1532. messageSends: ["assert:equals:", "first:"]}),
  1533. smalltalk.ArrayTest);
  1534. smalltalk.addMethod(
  1535. smalltalk.method({
  1536. selector: "testIfEmpty",
  1537. fn: function (){
  1538. var self=this;
  1539. return smalltalk.withContext(function($ctx1) {
  1540. self._assert_equals_(""._ifEmpty_((function(){
  1541. return smalltalk.withContext(function($ctx2) {
  1542. return "zork";
  1543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  1544. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  1545. messageSends: ["assert:equals:", "ifEmpty:"]}),
  1546. smalltalk.ArrayTest);
  1547. smalltalk.addMethod(
  1548. smalltalk.method({
  1549. selector: "testPrintString",
  1550. fn: function (){
  1551. var self=this;
  1552. var array;
  1553. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1,$2,$3,$4;
  1556. array=_st($Array())._new();
  1557. self._assert_equals_(_st(array)._printString(),"an Array ()");
  1558. $1=array;
  1559. _st($1)._add_((1));
  1560. $2=_st($1)._add_((3));
  1561. self._assert_equals_(_st(array)._printString(),"an Array (1 3)");
  1562. _st(array)._add_("foo");
  1563. self._assert_equals_(_st(array)._printString(),"an Array (1 3 'foo')");
  1564. $3=array;
  1565. _st($3)._remove_((1));
  1566. $4=_st($3)._remove_((3));
  1567. self._assert_equals_(_st(array)._printString(),"an Array ('foo')");
  1568. _st(array)._addLast_((3));
  1569. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3)");
  1570. _st(array)._addLast_((3));
  1571. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  1572. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  1573. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]}),
  1574. smalltalk.ArrayTest);
  1575. smalltalk.addMethod(
  1576. smalltalk.method({
  1577. selector: "testRemoveFromTo",
  1578. fn: function (){
  1579. var self=this;
  1580. return smalltalk.withContext(function($ctx1) {
  1581. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((1),(3)),[(4)]);
  1582. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(3)),[(1), (4)]);
  1583. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  1584. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  1585. messageSends: ["assert:equals:", "removeFrom:to:"]}),
  1586. smalltalk.ArrayTest);
  1587. smalltalk.addMethod(
  1588. smalltalk.method({
  1589. selector: "testRemoveIndex",
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((2)),[(1), (3), (4)]);
  1594. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((1)),[(2), (3), (4)]);
  1595. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  1596. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  1597. messageSends: ["assert:equals:", "removeIndex:"]}),
  1598. smalltalk.ArrayTest);
  1599. smalltalk.addMethod(
  1600. smalltalk.method({
  1601. selector: "collectionClass",
  1602. fn: function (){
  1603. var self=this;
  1604. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1605. return smalltalk.withContext(function($ctx1) {
  1606. var $1;
  1607. $1=$Array();
  1608. return $1;
  1609. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  1610. messageSends: []}),
  1611. smalltalk.ArrayTest.klass);
  1612. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1613. smalltalk.addMethod(
  1614. smalltalk.method({
  1615. selector: "collection",
  1616. fn: function (){
  1617. var self=this;
  1618. return smalltalk.withContext(function($ctx1) {
  1619. return "hello";
  1620. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  1621. messageSends: []}),
  1622. smalltalk.StringTest);
  1623. smalltalk.addMethod(
  1624. smalltalk.method({
  1625. selector: "collectionWithDuplicates",
  1626. fn: function (){
  1627. var self=this;
  1628. return smalltalk.withContext(function($ctx1) {
  1629. return "abbaerte";
  1630. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  1631. messageSends: []}),
  1632. smalltalk.StringTest);
  1633. smalltalk.addMethod(
  1634. smalltalk.method({
  1635. selector: "testAddRemove",
  1636. fn: function (){
  1637. var self=this;
  1638. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1639. return smalltalk.withContext(function($ctx1) {
  1640. self._should_raise_((function(){
  1641. return smalltalk.withContext(function($ctx2) {
  1642. return "hello"._add_("a");
  1643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1644. self._should_raise_((function(){
  1645. return smalltalk.withContext(function($ctx2) {
  1646. return "hello"._remove_("h");
  1647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1648. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  1649. messageSends: ["should:raise:", "add:", "remove:"]}),
  1650. smalltalk.StringTest);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "testAsArray",
  1654. fn: function (){
  1655. var self=this;
  1656. return smalltalk.withContext(function($ctx1) {
  1657. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  1658. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  1659. messageSends: ["assert:equals:", "asArray"]}),
  1660. smalltalk.StringTest);
  1661. smalltalk.addMethod(
  1662. smalltalk.method({
  1663. selector: "testAt",
  1664. fn: function (){
  1665. var self=this;
  1666. return smalltalk.withContext(function($ctx1) {
  1667. self._assert_equals_("hello"._at_((1)),"h");
  1668. self._assert_equals_("hello"._at_((5)),"o");
  1669. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  1670. return smalltalk.withContext(function($ctx2) {
  1671. return nil;
  1672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  1673. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  1674. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"]}),
  1675. smalltalk.StringTest);
  1676. smalltalk.addMethod(
  1677. smalltalk.method({
  1678. selector: "testAtPut",
  1679. fn: function (){
  1680. var self=this;
  1681. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1682. return smalltalk.withContext(function($ctx1) {
  1683. self._should_raise_((function(){
  1684. return smalltalk.withContext(function($ctx2) {
  1685. return "hello"._at_put_((1),"a");
  1686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1687. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  1688. messageSends: ["should:raise:", "at:put:"]}),
  1689. smalltalk.StringTest);
  1690. smalltalk.addMethod(
  1691. smalltalk.method({
  1692. selector: "testCollect",
  1693. fn: function (){
  1694. var self=this;
  1695. var newCollection;
  1696. return smalltalk.withContext(function($ctx1) {
  1697. newCollection="hheelllloo";
  1698. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1699. return smalltalk.withContext(function($ctx2) {
  1700. return _st(each).__comma(each);
  1701. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1702. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  1703. messageSends: ["assertSameContents:as:", "collect:", "collection", ","]}),
  1704. smalltalk.StringTest);
  1705. smalltalk.addMethod(
  1706. smalltalk.method({
  1707. selector: "testCopyWithoutAll",
  1708. fn: function (){
  1709. var self=this;
  1710. return smalltalk.withContext(function($ctx1) {
  1711. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  1712. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  1713. messageSends: ["assert:equals:", "copyWithoutAll:"]}),
  1714. smalltalk.StringTest);
  1715. smalltalk.addMethod(
  1716. smalltalk.method({
  1717. selector: "testDetect",
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. self._assert_equals_(_st(self._collection())._detect_((function(each){
  1723. return smalltalk.withContext(function($ctx2) {
  1724. return _st(each).__eq("h");
  1725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),"h");
  1726. self._should_raise_((function(){
  1727. return smalltalk.withContext(function($ctx2) {
  1728. return _st(self._collection())._detect_((function(each){
  1729. return smalltalk.withContext(function($ctx3) {
  1730. return _st(each).__eq((6));
  1731. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1733. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  1734. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"]}),
  1735. smalltalk.StringTest);
  1736. smalltalk.addMethod(
  1737. smalltalk.method({
  1738. selector: "testEquality",
  1739. fn: function (){
  1740. var self=this;
  1741. return smalltalk.withContext(function($ctx1) {
  1742. self._assert_equals_("hello","hello");
  1743. self._deny_("hello".__eq("world"));
  1744. self._deny_("hello".__eq([]._at_ifAbsent_((1),(function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))));
  1747. self._assert_equals_("hello","hello"._yourself());
  1748. self._assert_equals_("hello"._yourself(),"hello");
  1749. self._deny_("".__eq((0)));
  1750. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  1751. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]}),
  1752. smalltalk.StringTest);
  1753. smalltalk.addMethod(
  1754. smalltalk.method({
  1755. selector: "testIdentity",
  1756. fn: function (){
  1757. var self=this;
  1758. return smalltalk.withContext(function($ctx1) {
  1759. self._assert_("hello".__eq_eq("hello"));
  1760. self._deny_("hello".__eq_eq("world"));
  1761. self._assert_("hello".__eq_eq("hello"._yourself()));
  1762. self._assert_(_st("hello"._yourself()).__eq_eq("hello"));
  1763. self._deny_("".__eq_eq((0)));
  1764. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  1765. messageSends: ["assert:", "==", "deny:", "yourself"]}),
  1766. smalltalk.StringTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testIncludesSubString",
  1770. fn: function (){
  1771. var self=this;
  1772. return smalltalk.withContext(function($ctx1) {
  1773. self._assert_("amber"._includesSubString_("ber"));
  1774. self._deny_("amber"._includesSubString_("zork"));
  1775. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  1776. messageSends: ["assert:", "includesSubString:", "deny:"]}),
  1777. smalltalk.StringTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testIndexOf",
  1781. fn: function (){
  1782. var self=this;
  1783. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1784. return smalltalk.withContext(function($ctx1) {
  1785. self._assert_equals_(_st(self._collection())._indexOf_("e"),(2));
  1786. self._should_raise_((function(){
  1787. return smalltalk.withContext(function($ctx2) {
  1788. return _st(self._collection())._indexOf_((999));
  1789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1790. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1791. return smalltalk.withContext(function($ctx2) {
  1792. return "sentinel";
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1794. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  1795. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  1796. smalltalk.StringTest);
  1797. smalltalk.addMethod(
  1798. smalltalk.method({
  1799. selector: "testJoin",
  1800. fn: function (){
  1801. var self=this;
  1802. return smalltalk.withContext(function($ctx1) {
  1803. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  1804. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  1805. messageSends: ["assert:equals:", "join:"]}),
  1806. smalltalk.StringTest);
  1807. smalltalk.addMethod(
  1808. smalltalk.method({
  1809. selector: "testSelect",
  1810. fn: function (){
  1811. var self=this;
  1812. var newCollection;
  1813. return smalltalk.withContext(function($ctx1) {
  1814. newCollection="o";
  1815. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1816. return smalltalk.withContext(function($ctx2) {
  1817. return _st(each).__eq("o");
  1818. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1819. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  1820. messageSends: ["assertSameContents:as:", "select:", "collection", "="]}),
  1821. smalltalk.StringTest);
  1822. smalltalk.addMethod(
  1823. smalltalk.method({
  1824. selector: "testSize",
  1825. fn: function (){
  1826. var self=this;
  1827. return smalltalk.withContext(function($ctx1) {
  1828. self._assert_equals_("smalltalk"._size(),(9));
  1829. self._assert_equals_(""._size(),(0));
  1830. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  1831. messageSends: ["assert:equals:", "size"]}),
  1832. smalltalk.StringTest);
  1833. smalltalk.addMethod(
  1834. smalltalk.method({
  1835. selector: "testStreamContents",
  1836. fn: function (){
  1837. var self=this;
  1838. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1839. return smalltalk.withContext(function($ctx1) {
  1840. var $1,$2;
  1841. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  1842. return smalltalk.withContext(function($ctx2) {
  1843. $1=aStream;
  1844. _st($1)._nextPutAll_("hello");
  1845. _st($1)._space();
  1846. $2=_st($1)._nextPutAll_("world");
  1847. return $2;
  1848. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  1849. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  1850. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]}),
  1851. smalltalk.StringTest);
  1852. smalltalk.addMethod(
  1853. smalltalk.method({
  1854. selector: "collectionClass",
  1855. fn: function (){
  1856. var self=this;
  1857. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1858. return smalltalk.withContext(function($ctx1) {
  1859. var $1;
  1860. $1=$String();
  1861. return $1;
  1862. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  1863. messageSends: []}),
  1864. smalltalk.StringTest.klass);
  1865. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1866. smalltalk.addMethod(
  1867. smalltalk.method({
  1868. selector: "testShow",
  1869. fn: function (){
  1870. var self=this;
  1871. var originalTranscript;
  1872. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  1873. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  1874. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1875. return smalltalk.withContext(function($ctx1) {
  1876. originalTranscript=_st($Transcript())._current();
  1877. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  1878. self._shouldnt_raise_((function(){
  1879. return smalltalk.withContext(function($ctx2) {
  1880. return _st($Transcript())._show_("Hello console!");
  1881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1882. self._shouldnt_raise_((function(){
  1883. return smalltalk.withContext(function($ctx2) {
  1884. return _st($Transcript())._show_(console);
  1885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1886. _st($Transcript())._register_(originalTranscript);
  1887. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  1888. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]}),
  1889. smalltalk.ConsoleTranscriptTest);
  1890. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "jsObject",
  1894. fn: function (){
  1895. var self=this;
  1896. return smalltalk.withContext(function($ctx1) {
  1897. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  1898. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  1899. messageSends: []}),
  1900. smalltalk.JSObjectProxyTest);
  1901. smalltalk.addMethod(
  1902. smalltalk.method({
  1903. selector: "testAtIfAbsent",
  1904. fn: function (){
  1905. var self=this;
  1906. var testObject;
  1907. return smalltalk.withContext(function($ctx1) {
  1908. testObject=self._jsObject();
  1909. self._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  1910. return smalltalk.withContext(function($ctx2) {
  1911. return "Property does not exist";
  1912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"Property does not exist");
  1913. self._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  1914. return smalltalk.withContext(function($ctx2) {
  1915. return "Property does not exist";
  1916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),nil);
  1917. self._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  1918. return smalltalk.withContext(function($ctx2) {
  1919. return "Property does not exist";
  1920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),(1));
  1921. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  1922. return smalltalk.withContext(function($ctx2) {
  1923. return "Property does not exist";
  1924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  1925. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1926. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]}),
  1927. smalltalk.JSObjectProxyTest);
  1928. smalltalk.addMethod(
  1929. smalltalk.method({
  1930. selector: "testAtIfPresent",
  1931. fn: function (){
  1932. var self=this;
  1933. var testObject;
  1934. return smalltalk.withContext(function($ctx1) {
  1935. testObject=self._jsObject();
  1936. self._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  1937. return smalltalk.withContext(function($ctx2) {
  1938. return "hello ".__comma(_st(x)._asString());
  1939. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})})),nil);
  1940. self._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  1941. return smalltalk.withContext(function($ctx2) {
  1942. return "hello ".__comma(_st(x)._asString());
  1943. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})})),"hello nil");
  1944. self._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  1945. return smalltalk.withContext(function($ctx2) {
  1946. return "hello ".__comma(_st(x)._asString());
  1947. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})})),"hello 1");
  1948. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  1949. return smalltalk.withContext(function($ctx2) {
  1950. return "hello ".__comma(_st(x)._asString());
  1951. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  1952. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1953. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]}),
  1954. smalltalk.JSObjectProxyTest);
  1955. smalltalk.addMethod(
  1956. smalltalk.method({
  1957. selector: "testAtIfPresentIfAbsent",
  1958. fn: function (){
  1959. var self=this;
  1960. var testObject;
  1961. return smalltalk.withContext(function($ctx1) {
  1962. testObject=self._jsObject();
  1963. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  1964. return smalltalk.withContext(function($ctx2) {
  1965. return "hello ".__comma(_st(x)._asString());
  1966. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  1967. return smalltalk.withContext(function($ctx2) {
  1968. return "not present";
  1969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"not present");
  1970. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  1971. return smalltalk.withContext(function($ctx2) {
  1972. return "hello ".__comma(_st(x)._asString());
  1973. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  1974. return smalltalk.withContext(function($ctx2) {
  1975. return "not present";
  1976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"hello nil");
  1977. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  1978. return smalltalk.withContext(function($ctx2) {
  1979. return "hello ".__comma(_st(x)._asString());
  1980. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  1981. return smalltalk.withContext(function($ctx2) {
  1982. return "not present";
  1983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})})),"hello 1");
  1984. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  1985. return smalltalk.withContext(function($ctx2) {
  1986. return "hello ".__comma(_st(x)._asString());
  1987. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  1988. return smalltalk.withContext(function($ctx2) {
  1989. return "not present";
  1990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  1991. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1992. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]}),
  1993. smalltalk.JSObjectProxyTest);
  1994. smalltalk.addMethod(
  1995. smalltalk.method({
  1996. selector: "testDNU",
  1997. fn: function (){
  1998. var self=this;
  1999. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2000. return smalltalk.withContext(function($ctx1) {
  2001. self._should_raise_((function(){
  2002. return smalltalk.withContext(function($ctx2) {
  2003. return _st(self._jsObject())._foo();
  2004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  2005. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  2006. messageSends: ["should:raise:", "foo", "jsObject"]}),
  2007. smalltalk.JSObjectProxyTest);
  2008. smalltalk.addMethod(
  2009. smalltalk.method({
  2010. selector: "testMessageSend",
  2011. fn: function (){
  2012. var self=this;
  2013. return smalltalk.withContext(function($ctx1) {
  2014. self._assert_equals_(_st(self._jsObject())._a(),(1));
  2015. self._assert_equals_(_st(self._jsObject())._b(),(2));
  2016. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  2017. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  2018. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]}),
  2019. smalltalk.JSObjectProxyTest);
  2020. smalltalk.addMethod(
  2021. smalltalk.method({
  2022. selector: "testMethodWithArguments",
  2023. fn: function (){
  2024. var self=this;
  2025. return smalltalk.withContext(function($ctx1) {
  2026. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  2027. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  2028. messageSends: ["assert:equals:", "c:", "jsObject"]}),
  2029. smalltalk.JSObjectProxyTest);
  2030. smalltalk.addMethod(
  2031. smalltalk.method({
  2032. selector: "testPrinting",
  2033. fn: function (){
  2034. var self=this;
  2035. return smalltalk.withContext(function($ctx1) {
  2036. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  2038. messageSends: ["assert:equals:", "printString", "jsObject"]}),
  2039. smalltalk.JSObjectProxyTest);
  2040. smalltalk.addMethod(
  2041. smalltalk.method({
  2042. selector: "testPropertyThatReturnsEmptyString",
  2043. fn: function (){
  2044. var self=this;
  2045. var object;
  2046. return smalltalk.withContext(function($ctx1) {
  2047. object=self._jsObject();
  2048. self._assert_equals_(_st(object)._d(),"");
  2049. _st(object)._d_("hello");
  2050. self._assert_equals_(_st(object)._d(),"hello");
  2051. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  2052. messageSends: ["jsObject", "assert:equals:", "d", "d:"]}),
  2053. smalltalk.JSObjectProxyTest);
  2054. smalltalk.addMethod(
  2055. smalltalk.method({
  2056. selector: "testPropertyThatReturnsUndefined",
  2057. fn: function (){
  2058. var self=this;
  2059. var object;
  2060. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2061. return smalltalk.withContext(function($ctx1) {
  2062. object=self._jsObject();
  2063. self._shouldnt_raise_((function(){
  2064. return smalltalk.withContext(function($ctx2) {
  2065. return _st(object)._e();
  2066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  2067. self._assert_(_st(_st(object)._e())._isNil());
  2068. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  2069. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]}),
  2070. smalltalk.JSObjectProxyTest);
  2071. smalltalk.addMethod(
  2072. smalltalk.method({
  2073. selector: "testValue",
  2074. fn: function (){
  2075. var self=this;
  2076. var testObject;
  2077. return smalltalk.withContext(function($ctx1) {
  2078. testObject=self._jsObject();
  2079. self._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2080. _st(testObject)._at_put_("value","aValue");
  2081. self._assert_equals_(_st(testObject)._value(),"aValue");
  2082. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2083. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"]}),
  2084. smalltalk.JSObjectProxyTest);
  2085. smalltalk.addMethod(
  2086. smalltalk.method({
  2087. selector: "testYourself",
  2088. fn: function (){
  2089. var self=this;
  2090. var object;
  2091. return smalltalk.withContext(function($ctx1) {
  2092. var $1,$2;
  2093. $1=self._jsObject();
  2094. _st($1)._d_("test");
  2095. $2=_st($1)._yourself();
  2096. object=$2;
  2097. self._assert_equals_(_st(object)._d(),"test");
  2098. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  2099. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]}),
  2100. smalltalk.JSObjectProxyTest);
  2101. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2102. smalltalk.addMethod(
  2103. smalltalk.method({
  2104. selector: "testCatchingException",
  2105. fn: function (){
  2106. var self=this;
  2107. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2108. return smalltalk.withContext(function($ctx1) {
  2109. _st((function(){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. return self._throwException();
  2112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  2113. return smalltalk.withContext(function($ctx2) {
  2114. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  2115. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  2116. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2117. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]}),
  2118. smalltalk.JavaScriptExceptionTest);
  2119. smalltalk.addMethod(
  2120. smalltalk.method({
  2121. selector: "testRaisingException",
  2122. fn: function (){
  2123. var self=this;
  2124. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2125. return smalltalk.withContext(function($ctx1) {
  2126. self._should_raise_((function(){
  2127. return smalltalk.withContext(function($ctx2) {
  2128. return self._throwException();
  2129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  2130. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2131. messageSends: ["should:raise:", "throwException"]}),
  2132. smalltalk.JavaScriptExceptionTest);
  2133. smalltalk.addMethod(
  2134. smalltalk.method({
  2135. selector: "throwException",
  2136. fn: function (){
  2137. var self=this;
  2138. return smalltalk.withContext(function($ctx1) {
  2139. throw 'test';
  2140. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2141. messageSends: []}),
  2142. smalltalk.JavaScriptExceptionTest);
  2143. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2144. smalltalk.addMethod(
  2145. smalltalk.method({
  2146. selector: "testValue",
  2147. fn: function (){
  2148. var self=this;
  2149. var messageSend;
  2150. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2151. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2152. return smalltalk.withContext(function($ctx1) {
  2153. var $1,$2;
  2154. $1=_st($MessageSend())._new();
  2155. _st($1)._receiver_(_st($Object())._new());
  2156. _st($1)._selector_("asString");
  2157. $2=_st($1)._yourself();
  2158. messageSend=$2;
  2159. self._assert_equals_(_st(messageSend)._value(),"an Object");
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2161. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]}),
  2162. smalltalk.MessageSendTest);
  2163. smalltalk.addMethod(
  2164. smalltalk.method({
  2165. selector: "testValueWithArguments",
  2166. fn: function (){
  2167. var self=this;
  2168. var messageSend;
  2169. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2170. return smalltalk.withContext(function($ctx1) {
  2171. var $1,$2;
  2172. $1=_st($MessageSend())._new();
  2173. _st($1)._receiver_((2));
  2174. _st($1)._selector_("+");
  2175. $2=_st($1)._yourself();
  2176. messageSend=$2;
  2177. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  2178. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2179. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2180. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]}),
  2181. smalltalk.MessageSendTest);
  2182. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2183. smalltalk.addMethod(
  2184. smalltalk.method({
  2185. selector: "testAbs",
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. self._assert_equals_((4)._abs(),(4));
  2190. self._assert_equals_((-4)._abs(),(4));
  2191. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  2192. messageSends: ["assert:equals:", "abs"]}),
  2193. smalltalk.NumberTest);
  2194. smalltalk.addMethod(
  2195. smalltalk.method({
  2196. selector: "testArithmetic",
  2197. fn: function (){
  2198. var self=this;
  2199. return smalltalk.withContext(function($ctx1) {
  2200. self._assert_equals_((1.5).__plus((1)),(2.5));
  2201. self._assert_equals_((2).__minus((1)),(1));
  2202. self._assert_equals_((-2).__minus((1)),(-3));
  2203. self._assert_equals_((12).__slash((2)),(6));
  2204. self._assert_equals_((3).__star((4)),(12));
  2205. self._assert_equals_(_st((1).__plus((2))).__star((3)),(9));
  2206. self._assert_equals_((1).__plus((2).__star((3))),(7));
  2207. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  2208. messageSends: ["assert:equals:", "+", "-", "/", "*"]}),
  2209. smalltalk.NumberTest);
  2210. smalltalk.addMethod(
  2211. smalltalk.method({
  2212. selector: "testComparison",
  2213. fn: function (){
  2214. var self=this;
  2215. return smalltalk.withContext(function($ctx1) {
  2216. self._assert_((3).__gt((2)));
  2217. self._assert_((2).__lt((3)));
  2218. self._deny_((3).__lt((2)));
  2219. self._deny_((2).__gt((3)));
  2220. self._assert_((3).__gt_eq((3)));
  2221. self._assert_((3.1).__gt_eq((3)));
  2222. self._assert_((3).__lt_eq((3)));
  2223. self._assert_((3).__lt_eq((3.1)));
  2224. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  2225. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]}),
  2226. smalltalk.NumberTest);
  2227. smalltalk.addMethod(
  2228. smalltalk.method({
  2229. selector: "testCopying",
  2230. fn: function (){
  2231. var self=this;
  2232. return smalltalk.withContext(function($ctx1) {
  2233. self._assert_(_st((1)._copy()).__eq_eq((1)));
  2234. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  2235. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  2236. messageSends: ["assert:", "==", "copy", "deepCopy"]}),
  2237. smalltalk.NumberTest);
  2238. smalltalk.addMethod(
  2239. smalltalk.method({
  2240. selector: "testEquality",
  2241. fn: function (){
  2242. var self=this;
  2243. return smalltalk.withContext(function($ctx1) {
  2244. self._assert_((1).__eq((1)));
  2245. self._assert_((0).__eq((0)));
  2246. self._deny_((1).__eq((0)));
  2247. self._assert_(_st((1)._yourself()).__eq((1)));
  2248. self._assert_((1).__eq((1)._yourself()));
  2249. self._assert_(_st((1)._yourself()).__eq((1)._yourself()));
  2250. self._deny_((0).__eq(false));
  2251. self._deny_(false.__eq((0)));
  2252. self._deny_("".__eq((0)));
  2253. self._deny_((0).__eq(""));
  2254. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  2255. messageSends: ["assert:", "=", "deny:", "yourself"]}),
  2256. smalltalk.NumberTest);
  2257. smalltalk.addMethod(
  2258. smalltalk.method({
  2259. selector: "testHexNumbers",
  2260. fn: function (){
  2261. var self=this;
  2262. return smalltalk.withContext(function($ctx1) {
  2263. self._assert_equals_((9),(9));
  2264. self._assert_equals_((10)._truncated(),(10));
  2265. self._assert_equals_((11)._truncated(),(11));
  2266. self._assert_equals_((12)._truncated(),(12));
  2267. self._assert_equals_((13)._truncated(),(13));
  2268. self._assert_equals_((14)._truncated(),(14));
  2269. self._assert_equals_((15)._truncated(),(15));
  2270. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  2271. messageSends: ["assert:equals:", "truncated"]}),
  2272. smalltalk.NumberTest);
  2273. smalltalk.addMethod(
  2274. smalltalk.method({
  2275. selector: "testIdentity",
  2276. fn: function (){
  2277. var self=this;
  2278. return smalltalk.withContext(function($ctx1) {
  2279. self._assert_((1).__eq_eq((1)));
  2280. self._assert_((0).__eq_eq((0)));
  2281. self._deny_((1).__eq_eq((0)));
  2282. self._assert_(_st((1)._yourself()).__eq_eq((1)));
  2283. self._assert_((1).__eq_eq((1)._yourself()));
  2284. self._assert_(_st((1)._yourself()).__eq_eq((1)._yourself()));
  2285. self._deny_((1).__eq_eq((2)));
  2286. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  2287. messageSends: ["assert:", "==", "deny:", "yourself"]}),
  2288. smalltalk.NumberTest);
  2289. smalltalk.addMethod(
  2290. smalltalk.method({
  2291. selector: "testInvalidHexNumbers",
  2292. fn: function (){
  2293. var self=this;
  2294. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2295. return smalltalk.withContext(function($ctx1) {
  2296. self._should_raise_((function(){
  2297. return smalltalk.withContext(function($ctx2) {
  2298. return (16)._rG();
  2299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  2300. self._should_raise_((function(){
  2301. return smalltalk.withContext(function($ctx2) {
  2302. return (16)._rg();
  2303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  2304. self._should_raise_((function(){
  2305. return smalltalk.withContext(function($ctx2) {
  2306. return (16)._rH();
  2307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  2308. self._should_raise_((function(){
  2309. return smalltalk.withContext(function($ctx2) {
  2310. return (16)._rh();
  2311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  2312. self._should_raise_((function(){
  2313. return smalltalk.withContext(function($ctx2) {
  2314. return (16)._rI();
  2315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  2316. self._should_raise_((function(){
  2317. return smalltalk.withContext(function($ctx2) {
  2318. return (16)._ri();
  2319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  2320. self._should_raise_((function(){
  2321. return smalltalk.withContext(function($ctx2) {
  2322. return (16)._rJ();
  2323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  2324. self._should_raise_((function(){
  2325. return smalltalk.withContext(function($ctx2) {
  2326. return (16)._rj();
  2327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  2328. self._should_raise_((function(){
  2329. return smalltalk.withContext(function($ctx2) {
  2330. return (16)._rK();
  2331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  2332. self._should_raise_((function(){
  2333. return smalltalk.withContext(function($ctx2) {
  2334. return (16)._rk();
  2335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  2336. self._should_raise_((function(){
  2337. return smalltalk.withContext(function($ctx2) {
  2338. return (16)._rL();
  2339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  2340. self._should_raise_((function(){
  2341. return smalltalk.withContext(function($ctx2) {
  2342. return (16)._rl();
  2343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  2344. self._should_raise_((function(){
  2345. return smalltalk.withContext(function($ctx2) {
  2346. return (16)._rM();
  2347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  2348. self._should_raise_((function(){
  2349. return smalltalk.withContext(function($ctx2) {
  2350. return (16)._rm();
  2351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  2352. self._should_raise_((function(){
  2353. return smalltalk.withContext(function($ctx2) {
  2354. return (16)._rN();
  2355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  2356. self._should_raise_((function(){
  2357. return smalltalk.withContext(function($ctx2) {
  2358. return (16)._rn();
  2359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  2360. self._should_raise_((function(){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. return (16)._rO();
  2363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  2364. self._should_raise_((function(){
  2365. return smalltalk.withContext(function($ctx2) {
  2366. return (16)._ro();
  2367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  2368. self._should_raise_((function(){
  2369. return smalltalk.withContext(function($ctx2) {
  2370. return (16)._rP();
  2371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  2372. self._should_raise_((function(){
  2373. return smalltalk.withContext(function($ctx2) {
  2374. return (16)._rp();
  2375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  2376. self._should_raise_((function(){
  2377. return smalltalk.withContext(function($ctx2) {
  2378. return (16)._rQ();
  2379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  2380. self._should_raise_((function(){
  2381. return smalltalk.withContext(function($ctx2) {
  2382. return (16)._rq();
  2383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  2384. self._should_raise_((function(){
  2385. return smalltalk.withContext(function($ctx2) {
  2386. return (16)._rR();
  2387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  2388. self._should_raise_((function(){
  2389. return smalltalk.withContext(function($ctx2) {
  2390. return (16)._rr();
  2391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  2392. self._should_raise_((function(){
  2393. return smalltalk.withContext(function($ctx2) {
  2394. return (16)._rS();
  2395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  2396. self._should_raise_((function(){
  2397. return smalltalk.withContext(function($ctx2) {
  2398. return (16)._rs();
  2399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  2400. self._should_raise_((function(){
  2401. return smalltalk.withContext(function($ctx2) {
  2402. return (16)._rT();
  2403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  2404. self._should_raise_((function(){
  2405. return smalltalk.withContext(function($ctx2) {
  2406. return (16)._rt();
  2407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  2408. self._should_raise_((function(){
  2409. return smalltalk.withContext(function($ctx2) {
  2410. return (16)._rU();
  2411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  2412. self._should_raise_((function(){
  2413. return smalltalk.withContext(function($ctx2) {
  2414. return (16)._ru();
  2415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  2416. self._should_raise_((function(){
  2417. return smalltalk.withContext(function($ctx2) {
  2418. return (16)._rV();
  2419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  2420. self._should_raise_((function(){
  2421. return smalltalk.withContext(function($ctx2) {
  2422. return (16)._rv();
  2423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  2424. self._should_raise_((function(){
  2425. return smalltalk.withContext(function($ctx2) {
  2426. return (16)._rW();
  2427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  2428. self._should_raise_((function(){
  2429. return smalltalk.withContext(function($ctx2) {
  2430. return (16)._rw();
  2431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  2432. self._should_raise_((function(){
  2433. return smalltalk.withContext(function($ctx2) {
  2434. return (16)._rX();
  2435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  2436. self._should_raise_((function(){
  2437. return smalltalk.withContext(function($ctx2) {
  2438. return (16)._rx();
  2439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  2440. self._should_raise_((function(){
  2441. return smalltalk.withContext(function($ctx2) {
  2442. return (16)._rY();
  2443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  2444. self._should_raise_((function(){
  2445. return smalltalk.withContext(function($ctx2) {
  2446. return (16)._ry();
  2447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  2448. self._should_raise_((function(){
  2449. return smalltalk.withContext(function($ctx2) {
  2450. return (16)._rZ();
  2451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  2452. self._should_raise_((function(){
  2453. return smalltalk.withContext(function($ctx2) {
  2454. return (16)._rz();
  2455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  2456. self._should_raise_((function(){
  2457. return smalltalk.withContext(function($ctx2) {
  2458. return (11259375)._Z();
  2459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  2460. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  2461. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"]}),
  2462. smalltalk.NumberTest);
  2463. smalltalk.addMethod(
  2464. smalltalk.method({
  2465. selector: "testMinMax",
  2466. fn: function (){
  2467. var self=this;
  2468. return smalltalk.withContext(function($ctx1) {
  2469. self._assert_equals_((2)._max_((5)),(5));
  2470. self._assert_equals_((2)._min_((5)),(2));
  2471. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  2472. messageSends: ["assert:equals:", "max:", "min:"]}),
  2473. smalltalk.NumberTest);
  2474. smalltalk.addMethod(
  2475. smalltalk.method({
  2476. selector: "testNegated",
  2477. fn: function (){
  2478. var self=this;
  2479. return smalltalk.withContext(function($ctx1) {
  2480. self._assert_equals_((3)._negated(),(-3));
  2481. self._assert_equals_((-3)._negated(),(3));
  2482. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  2483. messageSends: ["assert:equals:", "negated"]}),
  2484. smalltalk.NumberTest);
  2485. smalltalk.addMethod(
  2486. smalltalk.method({
  2487. selector: "testPrintShowingDecimalPlaces",
  2488. fn: function (){
  2489. var self=this;
  2490. return smalltalk.withContext(function($ctx1) {
  2491. self._assert_equals_((23)._printShowingDecimalPlaces_((2)),"23.00");
  2492. self._assert_equals_((23.5698)._printShowingDecimalPlaces_((2)),"23.57");
  2493. self._assert_equals_(_st((234.567)._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  2494. self._assert_equals_((23.4567)._printShowingDecimalPlaces_((0)),"23");
  2495. self._assert_equals_((23.5567)._printShowingDecimalPlaces_((0)),"24");
  2496. self._assert_equals_(_st((23.4567)._negated())._printShowingDecimalPlaces_((0)),"-23");
  2497. self._assert_equals_(_st((23.5567)._negated())._printShowingDecimalPlaces_((0)),"-24");
  2498. self._assert_equals_((100000000)._printShowingDecimalPlaces_((1)),"100000000.0");
  2499. self._assert_equals_((0.98)._printShowingDecimalPlaces_((5)),"0.98000");
  2500. self._assert_equals_(_st((0.98)._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  2501. self._assert_equals_((2.567)._printShowingDecimalPlaces_((2)),"2.57");
  2502. self._assert_equals_((-2.567)._printShowingDecimalPlaces_((2)),"-2.57");
  2503. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  2504. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  2505. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]}),
  2506. smalltalk.NumberTest);
  2507. smalltalk.addMethod(
  2508. smalltalk.method({
  2509. selector: "testRounded",
  2510. fn: function (){
  2511. var self=this;
  2512. return smalltalk.withContext(function($ctx1) {
  2513. self._assert_equals_((3)._rounded(),(3));
  2514. self._assert_equals_((3.212)._rounded(),(3));
  2515. self._assert_equals_((3.51)._rounded(),(4));
  2516. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  2517. messageSends: ["assert:equals:", "rounded"]}),
  2518. smalltalk.NumberTest);
  2519. smalltalk.addMethod(
  2520. smalltalk.method({
  2521. selector: "testSqrt",
  2522. fn: function (){
  2523. var self=this;
  2524. return smalltalk.withContext(function($ctx1) {
  2525. self._assert_equals_((4)._sqrt(),(2));
  2526. self._assert_equals_((16)._sqrt(),(4));
  2527. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  2528. messageSends: ["assert:equals:", "sqrt"]}),
  2529. smalltalk.NumberTest);
  2530. smalltalk.addMethod(
  2531. smalltalk.method({
  2532. selector: "testSquared",
  2533. fn: function (){
  2534. var self=this;
  2535. return smalltalk.withContext(function($ctx1) {
  2536. self._assert_equals_((4)._squared(),(16));
  2537. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  2538. messageSends: ["assert:equals:", "squared"]}),
  2539. smalltalk.NumberTest);
  2540. smalltalk.addMethod(
  2541. smalltalk.method({
  2542. selector: "testTimesRepeat",
  2543. fn: function (){
  2544. var self=this;
  2545. var i;
  2546. return smalltalk.withContext(function($ctx1) {
  2547. i=(0);
  2548. (0)._timesRepeat_((function(){
  2549. return smalltalk.withContext(function($ctx2) {
  2550. i=_st(i).__plus((1));
  2551. return i;
  2552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2553. self._assert_equals_(i,(0));
  2554. (5)._timesRepeat_((function(){
  2555. return smalltalk.withContext(function($ctx2) {
  2556. i=_st(i).__plus((1));
  2557. return i;
  2558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2559. self._assert_equals_(i,(5));
  2560. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  2561. messageSends: ["timesRepeat:", "+", "assert:equals:"]}),
  2562. smalltalk.NumberTest);
  2563. smalltalk.addMethod(
  2564. smalltalk.method({
  2565. selector: "testTo",
  2566. fn: function (){
  2567. var self=this;
  2568. return smalltalk.withContext(function($ctx1) {
  2569. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  2570. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  2571. messageSends: ["assert:equals:", "to:"]}),
  2572. smalltalk.NumberTest);
  2573. smalltalk.addMethod(
  2574. smalltalk.method({
  2575. selector: "testToBy",
  2576. fn: function (){
  2577. var self=this;
  2578. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2579. return smalltalk.withContext(function($ctx1) {
  2580. self._assert_equals_((0)._to_by_((6),(2)),[(0), (2), (4), (6)]);
  2581. self._should_raise_((function(){
  2582. return smalltalk.withContext(function($ctx2) {
  2583. return (1)._to_by_((4),(0));
  2584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2585. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  2586. messageSends: ["assert:equals:", "to:by:", "should:raise:"]}),
  2587. smalltalk.NumberTest);
  2588. smalltalk.addMethod(
  2589. smalltalk.method({
  2590. selector: "testTruncated",
  2591. fn: function (){
  2592. var self=this;
  2593. return smalltalk.withContext(function($ctx1) {
  2594. self._assert_equals_((3)._truncated(),(3));
  2595. self._assert_equals_((3.212)._truncated(),(3));
  2596. self._assert_equals_((3.51)._truncated(),(3));
  2597. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  2598. messageSends: ["assert:equals:", "truncated"]}),
  2599. smalltalk.NumberTest);
  2600. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  2601. smalltalk.addMethod(
  2602. smalltalk.method({
  2603. selector: "foo",
  2604. fn: function (){
  2605. var self=this;
  2606. return smalltalk.withContext(function($ctx1) {
  2607. var $1;
  2608. $1=self["@foo"];
  2609. return $1;
  2610. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  2611. messageSends: []}),
  2612. smalltalk.ObjectMock);
  2613. smalltalk.addMethod(
  2614. smalltalk.method({
  2615. selector: "foo:",
  2616. fn: function (anObject){
  2617. var self=this;
  2618. return smalltalk.withContext(function($ctx1) {
  2619. self["@foo"]=anObject;
  2620. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  2621. messageSends: []}),
  2622. smalltalk.ObjectMock);
  2623. smalltalk.addClass('ObjectMock2', smalltalk.ObjectMock, [], 'Kernel-Tests');
  2624. smalltalk.addMethod(
  2625. smalltalk.method({
  2626. selector: "foo",
  2627. fn: function (){
  2628. var self=this;
  2629. return smalltalk.withContext(function($ctx1) {
  2630. var $1;
  2631. $1=self["@foo"];
  2632. return $1;
  2633. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock2)})},
  2634. messageSends: []}),
  2635. smalltalk.ObjectMock2);
  2636. smalltalk.addMethod(
  2637. smalltalk.method({
  2638. selector: "foo:",
  2639. fn: function (anObject){
  2640. var self=this;
  2641. return smalltalk.withContext(function($ctx1) {
  2642. self["@foo"]=anObject;
  2643. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock2)})},
  2644. messageSends: []}),
  2645. smalltalk.ObjectMock2);
  2646. smalltalk.addClass('ObjectMock3', smalltalk.ObjectMock2, [], 'Kernel-Tests');
  2647. smalltalk.addClass('ObjectMock4', smalltalk.ObjectMock3, [], 'Kernel-Tests');
  2648. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2649. smalltalk.addMethod(
  2650. smalltalk.method({
  2651. selector: "notDefined",
  2652. fn: function (){
  2653. var self=this;
  2654. return smalltalk.withContext(function($ctx1) {
  2655. return undefined;;
  2656. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  2657. messageSends: []}),
  2658. smalltalk.ObjectTest);
  2659. smalltalk.addMethod(
  2660. smalltalk.method({
  2661. selector: "testBasicAccess",
  2662. fn: function (){
  2663. var self=this;
  2664. var o;
  2665. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2666. return smalltalk.withContext(function($ctx1) {
  2667. o=_st($Object())._new();
  2668. _st(o)._basicAt_put_("a",(1));
  2669. self._assert_equals_(_st(o)._basicAt_("a"),(1));
  2670. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  2671. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  2672. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]}),
  2673. smalltalk.ObjectTest);
  2674. smalltalk.addMethod(
  2675. smalltalk.method({
  2676. selector: "testBasicPerform",
  2677. fn: function (){
  2678. var self=this;
  2679. var o;
  2680. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2681. return smalltalk.withContext(function($ctx1) {
  2682. o=_st($Object())._new();
  2683. _st(o)._basicAt_put_("func",(function(){
  2684. return smalltalk.withContext(function($ctx2) {
  2685. return "hello";
  2686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2687. _st(o)._basicAt_put_("func2",(function(a){
  2688. return smalltalk.withContext(function($ctx2) {
  2689. return _st(a).__plus((1));
  2690. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  2691. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  2692. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  2693. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  2694. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]}),
  2695. smalltalk.ObjectTest);
  2696. smalltalk.addMethod(
  2697. smalltalk.method({
  2698. selector: "testDNU",
  2699. fn: function (){
  2700. var self=this;
  2701. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2702. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2703. return smalltalk.withContext(function($ctx1) {
  2704. self._should_raise_((function(){
  2705. return smalltalk.withContext(function($ctx2) {
  2706. return _st(_st($Object())._new())._foo();
  2707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  2708. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  2709. messageSends: ["should:raise:", "foo", "new"]}),
  2710. smalltalk.ObjectTest);
  2711. smalltalk.addMethod(
  2712. smalltalk.method({
  2713. selector: "testEquality",
  2714. fn: function (){
  2715. var self=this;
  2716. var o;
  2717. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2718. return smalltalk.withContext(function($ctx1) {
  2719. o=_st($Object())._new();
  2720. self._deny_(_st(o).__eq(_st($Object())._new()));
  2721. self._assert_(_st(o).__eq(o));
  2722. self._assert_(_st(_st(o)._yourself()).__eq(o));
  2723. self._assert_(_st(o).__eq(_st(o)._yourself()));
  2724. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  2725. messageSends: ["new", "deny:", "=", "assert:", "yourself"]}),
  2726. smalltalk.ObjectTest);
  2727. smalltalk.addMethod(
  2728. smalltalk.method({
  2729. selector: "testHalt",
  2730. fn: function (){
  2731. var self=this;
  2732. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2733. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2734. return smalltalk.withContext(function($ctx1) {
  2735. self._should_raise_((function(){
  2736. return smalltalk.withContext(function($ctx2) {
  2737. return _st(_st($Object())._new())._halt();
  2738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2739. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  2740. messageSends: ["should:raise:", "halt", "new"]}),
  2741. smalltalk.ObjectTest);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "testIdentity",
  2745. fn: function (){
  2746. var self=this;
  2747. var o;
  2748. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2749. return smalltalk.withContext(function($ctx1) {
  2750. o=_st($Object())._new();
  2751. self._deny_(_st(o).__eq_eq(_st($Object())._new()));
  2752. self._assert_(_st(o).__eq_eq(o));
  2753. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2754. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  2755. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  2756. messageSends: ["new", "deny:", "==", "assert:", "yourself"]}),
  2757. smalltalk.ObjectTest);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "testIfNil",
  2761. fn: function (){
  2762. var self=this;
  2763. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2764. return smalltalk.withContext(function($ctx1) {
  2765. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  2766. self._deny_(_st(_st($Object())._new())._isNil());
  2767. $1=self;
  2768. $4=_st($Object())._new();
  2769. if(($receiver = $4) == nil || $receiver == undefined){
  2770. $3=true;
  2771. } else {
  2772. $3=$4;
  2773. };
  2774. $2=_st($3).__eq(true);
  2775. _st($1)._deny_($2);
  2776. $5=self;
  2777. $7=_st($Object())._new();
  2778. if(($receiver = $7) == nil || $receiver == undefined){
  2779. $6=$7;
  2780. } else {
  2781. $6=true;
  2782. };
  2783. _st($5)._assert_equals_($6,true);
  2784. $8=self;
  2785. $10=_st($Object())._new();
  2786. if(($receiver = $10) == nil || $receiver == undefined){
  2787. $9=false;
  2788. } else {
  2789. $9=true;
  2790. };
  2791. _st($8)._assert_equals_($9,true);
  2792. $11=self;
  2793. $13=_st($Object())._new();
  2794. if(($receiver = $13) == nil || $receiver == undefined){
  2795. $12=false;
  2796. } else {
  2797. $12=true;
  2798. };
  2799. _st($11)._assert_equals_($12,true);
  2800. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  2801. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]}),
  2802. smalltalk.ObjectTest);
  2803. smalltalk.addMethod(
  2804. smalltalk.method({
  2805. selector: "testInstVars",
  2806. fn: function (){
  2807. var self=this;
  2808. var o;
  2809. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  2810. return smalltalk.withContext(function($ctx1) {
  2811. o=_st($ObjectMock())._new();
  2812. self._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  2813. _st(o)._instVarAt_put_("foo",(1));
  2814. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  2815. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  2816. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  2817. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]}),
  2818. smalltalk.ObjectTest);
  2819. smalltalk.addMethod(
  2820. smalltalk.method({
  2821. selector: "testNilUndefined",
  2822. fn: function (){
  2823. var self=this;
  2824. return smalltalk.withContext(function($ctx1) {
  2825. self._assert_equals_(self._notDefined(),nil);
  2826. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  2827. messageSends: ["assert:equals:", "notDefined"]}),
  2828. smalltalk.ObjectTest);
  2829. smalltalk.addMethod(
  2830. smalltalk.method({
  2831. selector: "testYourself",
  2832. fn: function (){
  2833. var self=this;
  2834. var o;
  2835. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  2836. return smalltalk.withContext(function($ctx1) {
  2837. o=_st($ObjectMock())._new();
  2838. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2839. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  2840. messageSends: ["new", "assert:", "==", "yourself"]}),
  2841. smalltalk.ObjectTest);
  2842. smalltalk.addMethod(
  2843. smalltalk.method({
  2844. selector: "testidentityHash",
  2845. fn: function (){
  2846. var self=this;
  2847. var o1,o2;
  2848. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2849. return smalltalk.withContext(function($ctx1) {
  2850. o1=_st($Object())._new();
  2851. o2=_st($Object())._new();
  2852. self._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  2853. self._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  2854. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  2855. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]}),
  2856. smalltalk.ObjectTest);
  2857. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2858. smalltalk.addMethod(
  2859. smalltalk.method({
  2860. selector: "setUp",
  2861. fn: function (){
  2862. var self=this;
  2863. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2864. return smalltalk.withContext(function($ctx1) {
  2865. var $1,$2;
  2866. self["@backUpCommitPathJs"]=_st($Package())._defaultCommitPathJs();
  2867. self["@backUpCommitPathSt"]=_st($Package())._defaultCommitPathSt();
  2868. _st($Package())._resetCommitPaths();
  2869. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  2870. $1=_st($Package())._new();
  2871. _st($1)._name_("Grul");
  2872. _st($1)._commitPathJs_("server/grul/js");
  2873. _st($1)._commitPathSt_("grul/st");
  2874. $2=_st($1)._yourself();
  2875. self["@grulPackage"]=$2;
  2876. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageTest)})},
  2877. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"]}),
  2878. smalltalk.PackageTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "tearDown",
  2882. fn: function (){
  2883. var self=this;
  2884. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2885. return smalltalk.withContext(function($ctx1) {
  2886. var $1,$2;
  2887. $1=$Package();
  2888. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2889. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2890. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.PackageTest)})},
  2891. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"]}),
  2892. smalltalk.PackageTest);
  2893. smalltalk.addMethod(
  2894. smalltalk.method({
  2895. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2896. fn: function (){
  2897. var self=this;
  2898. return smalltalk.withContext(function($ctx1) {
  2899. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2900. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageTest)})},
  2901. messageSends: ["assert:equals:", "commitPathJs"]}),
  2902. smalltalk.PackageTest);
  2903. smalltalk.addMethod(
  2904. smalltalk.method({
  2905. selector: "testGrulCommitPathStShouldBeGrulSt",
  2906. fn: function (){
  2907. var self=this;
  2908. return smalltalk.withContext(function($ctx1) {
  2909. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2910. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageTest)})},
  2911. messageSends: ["assert:equals:", "commitPathSt"]}),
  2912. smalltalk.PackageTest);
  2913. smalltalk.addMethod(
  2914. smalltalk.method({
  2915. selector: "testZorkCommitPathJsShouldBeJs",
  2916. fn: function (){
  2917. var self=this;
  2918. return smalltalk.withContext(function($ctx1) {
  2919. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  2920. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.PackageTest)})},
  2921. messageSends: ["assert:equals:", "commitPathJs"]}),
  2922. smalltalk.PackageTest);
  2923. smalltalk.addMethod(
  2924. smalltalk.method({
  2925. selector: "testZorkCommitPathStShouldBeSt",
  2926. fn: function (){
  2927. var self=this;
  2928. return smalltalk.withContext(function($ctx1) {
  2929. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  2930. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.PackageTest)})},
  2931. messageSends: ["assert:equals:", "commitPathSt"]}),
  2932. smalltalk.PackageTest);
  2933. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2934. smalltalk.addMethod(
  2935. smalltalk.method({
  2936. selector: "setUp",
  2937. fn: function (){
  2938. var self=this;
  2939. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2940. return smalltalk.withContext(function($ctx1) {
  2941. var $1,$2;
  2942. smalltalk.PackageWithDefaultCommitPathChangedTest.superclass.fn.prototype._setUp.apply(_st(self), []);
  2943. $1=$Package();
  2944. _st($1)._defaultCommitPathJs_("javascripts/");
  2945. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2946. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2947. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"]}),
  2948. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2949. smalltalk.addMethod(
  2950. smalltalk.method({
  2951. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2952. fn: function (){
  2953. var self=this;
  2954. return smalltalk.withContext(function($ctx1) {
  2955. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2956. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2957. messageSends: ["assert:equals:", "commitPathJs"]}),
  2958. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2959. smalltalk.addMethod(
  2960. smalltalk.method({
  2961. selector: "testGrulCommitPathStShouldBeGrulSt",
  2962. fn: function (){
  2963. var self=this;
  2964. return smalltalk.withContext(function($ctx1) {
  2965. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2966. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2967. messageSends: ["assert:equals:", "commitPathSt"]}),
  2968. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2969. smalltalk.addMethod(
  2970. smalltalk.method({
  2971. selector: "testZorkCommitPathJsShouldBeJavascript",
  2972. fn: function (){
  2973. var self=this;
  2974. return smalltalk.withContext(function($ctx1) {
  2975. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  2976. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2977. messageSends: ["assert:equals:", "commitPathJs"]}),
  2978. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2979. smalltalk.addMethod(
  2980. smalltalk.method({
  2981. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2982. fn: function (){
  2983. var self=this;
  2984. return smalltalk.withContext(function($ctx1) {
  2985. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  2986. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2987. messageSends: ["assert:equals:", "commitPathSt"]}),
  2988. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2989. smalltalk.addMethod(
  2990. smalltalk.method({
  2991. selector: "shouldInheritSelectors",
  2992. fn: function (){
  2993. var self=this;
  2994. return smalltalk.withContext(function($ctx1) {
  2995. return false;
  2996. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.PackageWithDefaultCommitPathChangedTest.klass)})},
  2997. messageSends: []}),
  2998. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2999. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3000. smalltalk.addMethod(
  3001. smalltalk.method({
  3002. selector: "testAccessing",
  3003. fn: function (){
  3004. var self=this;
  3005. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3006. return smalltalk.withContext(function($ctx1) {
  3007. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  3008. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  3009. self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  3010. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  3011. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  3012. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]}),
  3013. smalltalk.PointTest);
  3014. smalltalk.addMethod(
  3015. smalltalk.method({
  3016. selector: "testArithmetic",
  3017. fn: function (){
  3018. var self=this;
  3019. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3020. return smalltalk.withContext(function($ctx1) {
  3021. self._assert_equals_(_st((3).__at((4))).__star((3).__at((4))),_st($Point())._x_y_((9),(16)));
  3022. self._assert_equals_(_st((3).__at((4))).__plus((3).__at((4))),_st($Point())._x_y_((6),(8)));
  3023. self._assert_equals_(_st((3).__at((4))).__minus((3).__at((4))),_st($Point())._x_y_((0),(0)));
  3024. self._assert_equals_(_st((6).__at((8))).__slash((3).__at((4))),_st($Point())._x_y_((2),(2)));
  3025. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  3026. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]}),
  3027. smalltalk.PointTest);
  3028. smalltalk.addMethod(
  3029. smalltalk.method({
  3030. selector: "testAt",
  3031. fn: function (){
  3032. var self=this;
  3033. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3034. return smalltalk.withContext(function($ctx1) {
  3035. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  3036. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  3037. messageSends: ["assert:equals:", "@", "x:y:"]}),
  3038. smalltalk.PointTest);
  3039. smalltalk.addMethod(
  3040. smalltalk.method({
  3041. selector: "testEgality",
  3042. fn: function (){
  3043. var self=this;
  3044. return smalltalk.withContext(function($ctx1) {
  3045. self._assert_(_st((3).__at((4))).__eq((3).__at((4))));
  3046. self._deny_(_st((3).__at((5))).__eq((3).__at((6))));
  3047. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  3048. messageSends: ["assert:", "=", "@", "deny:"]}),
  3049. smalltalk.PointTest);
  3050. smalltalk.addMethod(
  3051. smalltalk.method({
  3052. selector: "testTranslateBy",
  3053. fn: function (){
  3054. var self=this;
  3055. return smalltalk.withContext(function($ctx1) {
  3056. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1))),(3).__at((4)));
  3057. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1)._negated())),(3).__at((2)));
  3058. self._assert_equals_(_st((3).__at((3)))._translateBy_((2).__at((3))),(5).__at((6)));
  3059. self._assert_equals_(_st((3).__at((3)))._translateBy_(_st((3)._negated()).__at((0))),(0).__at((3)));
  3060. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  3061. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]}),
  3062. smalltalk.PointTest);
  3063. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3064. smalltalk.addMethod(
  3065. smalltalk.method({
  3066. selector: "textNext",
  3067. fn: function (){
  3068. var self=this;
  3069. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  3070. return smalltalk.withContext(function($ctx1) {
  3071. (10000)._timesRepeat_((function(){
  3072. var current,next;
  3073. return smalltalk.withContext(function($ctx2) {
  3074. next=_st(_st($Random())._new())._next();
  3075. next;
  3076. self._assert_(_st(next).__gt_eq((0)));
  3077. self._assert_(_st(next).__lt((1)));
  3078. self._deny_(_st(current).__eq(next));
  3079. return _st(next).__eq(current);
  3080. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  3081. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  3082. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]}),
  3083. smalltalk.RandomTest);
  3084. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3085. smalltalk.addMethod(
  3086. smalltalk.method({
  3087. selector: "testAddRemove",
  3088. fn: function (){
  3089. var self=this;
  3090. var set;
  3091. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3092. return smalltalk.withContext(function($ctx1) {
  3093. set=_st($Set())._new();
  3094. self._assert_(_st(set)._isEmpty());
  3095. _st(set)._add_((3));
  3096. self._assert_(_st(set)._includes_((3)));
  3097. _st(set)._add_((5));
  3098. self._assert_(_st(set)._includes_((5)));
  3099. _st(set)._remove_((3));
  3100. self._deny_(_st(set)._includes_((3)));
  3101. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  3102. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]}),
  3103. smalltalk.SetTest);
  3104. smalltalk.addMethod(
  3105. smalltalk.method({
  3106. selector: "testAt",
  3107. fn: function (){
  3108. var self=this;
  3109. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3110. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3111. return smalltalk.withContext(function($ctx1) {
  3112. self._should_raise_((function(){
  3113. return smalltalk.withContext(function($ctx2) {
  3114. return _st(_st($Set())._new())._at_put_((1),(2));
  3115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3116. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  3117. messageSends: ["should:raise:", "at:put:", "new"]}),
  3118. smalltalk.SetTest);
  3119. smalltalk.addMethod(
  3120. smalltalk.method({
  3121. selector: "testCollect",
  3122. fn: function (){
  3123. var self=this;
  3124. return smalltalk.withContext(function($ctx1) {
  3125. self._assert_equals_(_st([(5), (6), (8)]._asSet())._collect_((function(x){
  3126. return smalltalk.withContext(function($ctx2) {
  3127. return _st(x).__backslash_backslash((3));
  3128. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})})),[(0), (2)]._asSet());
  3129. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  3130. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"]}),
  3131. smalltalk.SetTest);
  3132. smalltalk.addMethod(
  3133. smalltalk.method({
  3134. selector: "testComparing",
  3135. fn: function (){
  3136. var self=this;
  3137. return smalltalk.withContext(function($ctx1) {
  3138. self._assert_equals_([(0), (2)]._asSet(),[(0), (2)]._asSet());
  3139. self._assert_equals_([(2), (0)]._asSet(),[(0), (2)]._asSet());
  3140. self._deny_(_st([(0), (2), (3)]._asSet()).__eq([(0), (2)]._asSet()));
  3141. self._deny_(_st([(1), (2)]._asSet()).__eq([(0), (2)]._asSet()));
  3142. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  3143. messageSends: ["assert:equals:", "asSet", "deny:", "="]}),
  3144. smalltalk.SetTest);
  3145. smalltalk.addMethod(
  3146. smalltalk.method({
  3147. selector: "testPrintString",
  3148. fn: function (){
  3149. var self=this;
  3150. var set;
  3151. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3152. return smalltalk.withContext(function($ctx1) {
  3153. var $1,$2,$3,$4;
  3154. set=_st($Set())._new();
  3155. self._assert_equals_(_st(set)._printString(),"a Set ()");
  3156. $1=set;
  3157. _st($1)._add_((1));
  3158. $2=_st($1)._add_((3));
  3159. self._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  3160. _st(set)._add_("foo");
  3161. self._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  3162. $3=set;
  3163. _st($3)._remove_((1));
  3164. $4=_st($3)._remove_((3));
  3165. self._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  3166. _st(set)._add_((3));
  3167. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3168. _st(set)._add_((3));
  3169. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3170. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  3171. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]}),
  3172. smalltalk.SetTest);
  3173. smalltalk.addMethod(
  3174. smalltalk.method({
  3175. selector: "testSize",
  3176. fn: function (){
  3177. var self=this;
  3178. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3179. return smalltalk.withContext(function($ctx1) {
  3180. self._assert_equals_(_st(_st($Set())._new())._size(),(0));
  3181. self._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  3182. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  3183. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  3184. messageSends: ["assert:equals:", "size", "new", "withAll:"]}),
  3185. smalltalk.SetTest);
  3186. smalltalk.addMethod(
  3187. smalltalk.method({
  3188. selector: "testUnboxedObjects",
  3189. fn: function (){
  3190. var self=this;
  3191. return smalltalk.withContext(function($ctx1) {
  3192. self._assert_equals_(_st(_st(["foo"._yourself(),"foo"._yourself()])._asSet())._asArray(),["foo"]);
  3193. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  3194. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]}),
  3195. smalltalk.SetTest);
  3196. smalltalk.addMethod(
  3197. smalltalk.method({
  3198. selector: "testUnicity",
  3199. fn: function (){
  3200. var self=this;
  3201. var set;
  3202. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3203. return smalltalk.withContext(function($ctx1) {
  3204. set=_st($Set())._new();
  3205. _st(set)._add_((21));
  3206. _st(set)._add_("hello");
  3207. _st(set)._add_((21));
  3208. self._assert_equals_(_st(set)._size(),(2));
  3209. _st(set)._add_("hello");
  3210. self._assert_equals_(_st(set)._size(),(2));
  3211. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  3212. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  3213. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]}),
  3214. smalltalk.SetTest);
  3215. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3216. smalltalk.addMethod(
  3217. smalltalk.method({
  3218. selector: "collectionClass",
  3219. fn: function (){
  3220. var self=this;
  3221. return smalltalk.withContext(function($ctx1) {
  3222. var $1;
  3223. $1=_st(self._class())._collectionClass();
  3224. return $1;
  3225. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  3226. messageSends: ["collectionClass", "class"]}),
  3227. smalltalk.StreamTest);
  3228. smalltalk.addMethod(
  3229. smalltalk.method({
  3230. selector: "newCollection",
  3231. fn: function (){
  3232. var self=this;
  3233. return smalltalk.withContext(function($ctx1) {
  3234. var $1;
  3235. $1=_st(self._collectionClass())._new();
  3236. return $1;
  3237. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  3238. messageSends: ["new", "collectionClass"]}),
  3239. smalltalk.StreamTest);
  3240. smalltalk.addMethod(
  3241. smalltalk.method({
  3242. selector: "newStream",
  3243. fn: function (){
  3244. var self=this;
  3245. return smalltalk.withContext(function($ctx1) {
  3246. var $1;
  3247. $1=_st(_st(self._collectionClass())._new())._stream();
  3248. return $1;
  3249. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  3250. messageSends: ["stream", "new", "collectionClass"]}),
  3251. smalltalk.StreamTest);
  3252. smalltalk.addMethod(
  3253. smalltalk.method({
  3254. selector: "testAtStartAtEnd",
  3255. fn: function (){
  3256. var self=this;
  3257. var stream;
  3258. return smalltalk.withContext(function($ctx1) {
  3259. stream=self._newStream();
  3260. self._assert_(_st(stream)._atStart());
  3261. self._assert_(_st(stream)._atEnd());
  3262. _st(stream)._nextPutAll_(self._newCollection());
  3263. self._assert_(_st(stream)._atEnd());
  3264. self._deny_(_st(stream)._atStart());
  3265. _st(stream)._position_((1));
  3266. self._deny_(_st(stream)._atEnd());
  3267. self._deny_(_st(stream)._atStart());
  3268. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  3269. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]}),
  3270. smalltalk.StreamTest);
  3271. smalltalk.addMethod(
  3272. smalltalk.method({
  3273. selector: "testContents",
  3274. fn: function (){
  3275. var self=this;
  3276. var stream;
  3277. return smalltalk.withContext(function($ctx1) {
  3278. stream=self._newStream();
  3279. _st(stream)._nextPutAll_(self._newCollection());
  3280. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  3281. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  3282. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]}),
  3283. smalltalk.StreamTest);
  3284. smalltalk.addMethod(
  3285. smalltalk.method({
  3286. selector: "testIsEmpty",
  3287. fn: function (){
  3288. var self=this;
  3289. var stream;
  3290. return smalltalk.withContext(function($ctx1) {
  3291. stream=self._newStream();
  3292. self._assert_(_st(stream)._isEmpty());
  3293. _st(stream)._nextPutAll_(self._newCollection());
  3294. self._deny_(_st(stream)._isEmpty());
  3295. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  3296. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]}),
  3297. smalltalk.StreamTest);
  3298. smalltalk.addMethod(
  3299. smalltalk.method({
  3300. selector: "testPosition",
  3301. fn: function (){
  3302. var self=this;
  3303. var collection,stream;
  3304. return smalltalk.withContext(function($ctx1) {
  3305. collection=self._newCollection();
  3306. stream=self._newStream();
  3307. _st(stream)._nextPutAll_(collection);
  3308. self._assert_equals_(_st(stream)._position(),_st(collection)._size());
  3309. _st(stream)._position_((0));
  3310. self._assert_equals_(_st(stream)._position(),(0));
  3311. _st(stream)._next();
  3312. self._assert_equals_(_st(stream)._position(),(1));
  3313. _st(stream)._next();
  3314. self._assert_equals_(_st(stream)._position(),(2));
  3315. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  3316. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]}),
  3317. smalltalk.StreamTest);
  3318. smalltalk.addMethod(
  3319. smalltalk.method({
  3320. selector: "testReading",
  3321. fn: function (){
  3322. var self=this;
  3323. var stream,collection;
  3324. return smalltalk.withContext(function($ctx1) {
  3325. var $1,$2;
  3326. collection=self._newCollection();
  3327. stream=self._newStream();
  3328. $1=stream;
  3329. _st($1)._nextPutAll_(collection);
  3330. $2=_st($1)._position_((0));
  3331. _st(collection)._do_((function(each){
  3332. return smalltalk.withContext(function($ctx2) {
  3333. return self._assert_equals_(_st(stream)._next(),each);
  3334. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3335. self._assert_(_st(_st(stream)._next())._isNil());
  3336. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3337. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]}),
  3338. smalltalk.StreamTest);
  3339. smalltalk.addMethod(
  3340. smalltalk.method({
  3341. selector: "testStreamContents",
  3342. fn: function (){
  3343. var self=this;
  3344. return smalltalk.withContext(function($ctx1) {
  3345. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  3346. messageSends: []}),
  3347. smalltalk.StreamTest);
  3348. smalltalk.addMethod(
  3349. smalltalk.method({
  3350. selector: "testWrite",
  3351. fn: function (){
  3352. var self=this;
  3353. var stream,collection;
  3354. return smalltalk.withContext(function($ctx1) {
  3355. collection=self._newCollection();
  3356. stream=self._newStream();
  3357. _st(collection)._do_((function(each){
  3358. return smalltalk.withContext(function($ctx2) {
  3359. return _st(stream).__lt_lt(each);
  3360. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3361. self._assert_equals_(_st(stream)._contents(),collection);
  3362. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3363. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]}),
  3364. smalltalk.StreamTest);
  3365. smalltalk.addMethod(
  3366. smalltalk.method({
  3367. selector: "testWriting",
  3368. fn: function (){
  3369. var self=this;
  3370. var stream,collection;
  3371. return smalltalk.withContext(function($ctx1) {
  3372. collection=self._newCollection();
  3373. stream=self._newStream();
  3374. _st(collection)._do_((function(each){
  3375. return smalltalk.withContext(function($ctx2) {
  3376. return _st(stream)._nextPut_(each);
  3377. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3378. self._assert_equals_(_st(stream)._contents(),collection);
  3379. stream=self._newStream();
  3380. _st(stream)._nextPutAll_(collection);
  3381. self._assert_equals_(_st(stream)._contents(),collection);
  3382. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3383. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]}),
  3384. smalltalk.StreamTest);
  3385. smalltalk.addMethod(
  3386. smalltalk.method({
  3387. selector: "collectionClass",
  3388. fn: function (){
  3389. var self=this;
  3390. return smalltalk.withContext(function($ctx1) {
  3391. return nil;
  3392. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  3393. messageSends: []}),
  3394. smalltalk.StreamTest.klass);
  3395. smalltalk.addMethod(
  3396. smalltalk.method({
  3397. selector: "isAbstract",
  3398. fn: function (){
  3399. var self=this;
  3400. return smalltalk.withContext(function($ctx1) {
  3401. var $1;
  3402. $1=_st(self._collectionClass())._isNil();
  3403. return $1;
  3404. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  3405. messageSends: ["isNil", "collectionClass"]}),
  3406. smalltalk.StreamTest.klass);
  3407. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  3408. smalltalk.addMethod(
  3409. smalltalk.method({
  3410. selector: "newCollection",
  3411. fn: function (){
  3412. var self=this;
  3413. return smalltalk.withContext(function($ctx1) {
  3414. var $1;
  3415. $1=[true,(1),(3).__at((4)),"foo"];
  3416. return $1;
  3417. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  3418. messageSends: ["@"]}),
  3419. smalltalk.ArrayStreamTest);
  3420. smalltalk.addMethod(
  3421. smalltalk.method({
  3422. selector: "collectionClass",
  3423. fn: function (){
  3424. var self=this;
  3425. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3426. return smalltalk.withContext(function($ctx1) {
  3427. var $1;
  3428. $1=$Array();
  3429. return $1;
  3430. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  3431. messageSends: []}),
  3432. smalltalk.ArrayStreamTest.klass);
  3433. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  3434. smalltalk.addMethod(
  3435. smalltalk.method({
  3436. selector: "newCollection",
  3437. fn: function (){
  3438. var self=this;
  3439. return smalltalk.withContext(function($ctx1) {
  3440. return "hello world";
  3441. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  3442. messageSends: []}),
  3443. smalltalk.StringStreamTest);
  3444. smalltalk.addMethod(
  3445. smalltalk.method({
  3446. selector: "collectionClass",
  3447. fn: function (){
  3448. var self=this;
  3449. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3450. return smalltalk.withContext(function($ctx1) {
  3451. var $1;
  3452. $1=$String();
  3453. return $1;
  3454. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  3455. messageSends: []}),
  3456. smalltalk.StringStreamTest.klass);
  3457. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3458. smalltalk.addMethod(
  3459. smalltalk.method({
  3460. selector: "testCopying",
  3461. fn: function (){
  3462. var self=this;
  3463. return smalltalk.withContext(function($ctx1) {
  3464. self._assert_equals_(nil._copy(),nil);
  3465. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  3466. messageSends: ["assert:equals:", "copy"]}),
  3467. smalltalk.UndefinedTest);
  3468. smalltalk.addMethod(
  3469. smalltalk.method({
  3470. selector: "testDeepCopy",
  3471. fn: function (){
  3472. var self=this;
  3473. return smalltalk.withContext(function($ctx1) {
  3474. self._assert_(_st(nil._deepCopy()).__eq(nil));
  3475. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  3476. messageSends: ["assert:", "=", "deepCopy"]}),
  3477. smalltalk.UndefinedTest);
  3478. smalltalk.addMethod(
  3479. smalltalk.method({
  3480. selector: "testIfNil",
  3481. fn: function (){
  3482. var self=this;
  3483. return smalltalk.withContext(function($ctx1) {
  3484. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  3485. $1=self;
  3486. if(($receiver = nil) == nil || $receiver == undefined){
  3487. $2=true;
  3488. } else {
  3489. $2=nil;
  3490. };
  3491. _st($1)._assert_equals_($2,true);
  3492. $3=self;
  3493. if(($receiver = nil) == nil || $receiver == undefined){
  3494. $5=nil;
  3495. } else {
  3496. $5=true;
  3497. };
  3498. $4=_st($5).__eq(true);
  3499. _st($3)._deny_($4);
  3500. $6=self;
  3501. if(($receiver = nil) == nil || $receiver == undefined){
  3502. $7=true;
  3503. } else {
  3504. $7=false;
  3505. };
  3506. _st($6)._assert_equals_($7,true);
  3507. $8=self;
  3508. if(($receiver = nil) == nil || $receiver == undefined){
  3509. $10=false;
  3510. } else {
  3511. $10=true;
  3512. };
  3513. $9=_st($10).__eq(true);
  3514. _st($8)._deny_($9);
  3515. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  3516. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]}),
  3517. smalltalk.UndefinedTest);
  3518. smalltalk.addMethod(
  3519. smalltalk.method({
  3520. selector: "testIsNil",
  3521. fn: function (){
  3522. var self=this;
  3523. return smalltalk.withContext(function($ctx1) {
  3524. self._assert_(nil._isNil());
  3525. self._deny_(nil._notNil());
  3526. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  3527. messageSends: ["assert:", "isNil", "deny:", "notNil"]}),
  3528. smalltalk.UndefinedTest);