Kernel-Tests.deploy.js 155 KB

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