Kernel-Tests.js 197 KB

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