1
0

Kernel-Tests.deploy.js 156 KB

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