Kernel-Tests.deploy.js 155 KB

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