Kernel-Tests.js 190 KB

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