1
0

Kernel-Tests.js 191 KB

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