Kernel-Tests.js 174 KB

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