Kernel-Tests.deploy.js 157 KB

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