Kernel-Tests.deploy.js 141 KB

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